Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Hiding a Dialog application on first run

Hiding a Dialog application on first run

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AmitCohen222
    wrote on last edited by
    #1

    Hello All ! I wish to hide (not display) the GUI of an MFC Dialog Based application on first run. When I use ShowWindow(SW_HIDE) inside OnInitialDialog() it doesn't seem to work. What should I do ?

    P H D 3 Replies Last reply
    0
    • A AmitCohen222

      Hello All ! I wish to hide (not display) the GUI of an MFC Dialog Based application on first run. When I use ShowWindow(SW_HIDE) inside OnInitialDialog() it doesn't seem to work. What should I do ?

      P Offline
      P Offline
      Perspx
      wrote on last edited by
      #2

      The reason is, because as stated by the documentation on MSDN, OnInitDialog() is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed, therefore if you call ShowWindow(SW_HIDE) then the window will be shown after OnInitDialog() returns. To solve this you should create your dialog without the WS_VISIBLE style. Regards, --Perspx

      "The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia Introduction to Object-Oriented JavaScript

      A 1 Reply Last reply
      0
      • A AmitCohen222

        Hello All ! I wish to hide (not display) the GUI of an MFC Dialog Based application on first run. When I use ShowWindow(SW_HIDE) inside OnInitialDialog() it doesn't seem to work. What should I do ?

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        You can make a little program for show it you must be use of FindWindow or EnumWindow for get a handle to your window of your program and then use of ShowWindow(SW_SHOW).

        1 Reply Last reply
        0
        • A AmitCohen222

          Hello All ! I wish to hide (not display) the GUI of an MFC Dialog Based application on first run. When I use ShowWindow(SW_HIDE) inside OnInitialDialog() it doesn't seem to work. What should I do ?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          AmitCohen222 wrote:

          I wish to hide (not display) the GUI of an MFC Dialog Based application on first run.

          See here.

          "Love people and use things, not love things and use people." - Unknown

          "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

          1 Reply Last reply
          0
          • P Perspx

            The reason is, because as stated by the documentation on MSDN, OnInitDialog() is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed, therefore if you call ShowWindow(SW_HIDE) then the window will be shown after OnInitDialog() returns. To solve this you should create your dialog without the WS_VISIBLE style. Regards, --Perspx

            "The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia Introduction to Object-Oriented JavaScript

            A Offline
            A Offline
            AmitCohen222
            wrote on last edited by
            #5

            OK. But where do I turn off the WS_VISIBLE flag ? Since it is a Dialog application there is no PreCreateWindow message. When I try to overwrite the structure in the OnCreate() it seems that it is already turned off. Should do it through OnInitialDialog() ? Or elsewhere ? Thanks, Amit

            P 1 Reply Last reply
            0
            • A AmitCohen222

              OK. But where do I turn off the WS_VISIBLE flag ? Since it is a Dialog application there is no PreCreateWindow message. When I try to overwrite the structure in the OnCreate() it seems that it is already turned off. Should do it through OnInitialDialog() ? Or elsewhere ? Thanks, Amit

              P Offline
              P Offline
              Perspx
              wrote on last edited by
              #6

              Is your dialog created from a resource? Regards, --Perspx

              "The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia Introduction to Object-Oriented JavaScript

              A 1 Reply Last reply
              0
              • P Perspx

                Is your dialog created from a resource? Regards, --Perspx

                "The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia Introduction to Object-Oriented JavaScript

                A Offline
                A Offline
                AmitCohen222
                wrote on last edited by
                #7

                No, I used Visual Studio 6.0 Wizard to create a standard Dialog based application. According to what Hamid answered it seems that there is no elegant way to do this, and the solution is to go around it... Amit C.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups