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. Hide Dialog

Hide Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
6 Posts 5 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.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    Hi, How to hide the dialogbox in win32. I tried ShowWindow(hWnd,0) in Initdialog()but fails to hide.

    K S R D 4 Replies Last reply
    0
    • J john5632

      Hi, How to hide the dialogbox in win32. I tried ShowWindow(hWnd,0) in Initdialog()but fails to hide.

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      you can only hide a dialog if you have already created it. A simple way is to only create a dialog if it has to be shown :-O

      Press F1 for help or google it. Greetings from Germany

      R 1 Reply Last reply
      0
      • J john5632

        Hi, How to hide the dialogbox in win32. I tried ShowWindow(hWnd,0) in Initdialog()but fails to hide.

        S Offline
        S Offline
        stebich
        wrote on last edited by
        #3

        If the dialogbox is the main window of your application look for the m_nCmdShow member of your CWinApp class. This member could be set in the InitInstance() method of your app. Here is an article about it: A Simple Method to Control the Startup State of an MFC SDI Application[^] If it is not the main window try to remove the WS_VISIBLE style from your dialog template.

        1 Reply Last reply
        0
        • J john5632

          Hi, How to hide the dialogbox in win32. I tried ShowWindow(hWnd,0) in Initdialog()but fails to hide.

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          Handle the first WM_PAINT message and call ShowWindow(hWnd, false); there. Because that's the first message that will be posted to the dialog after it's created.

          “Follow your bliss.” – Joseph Campbell

          1 Reply Last reply
          0
          • K KarstenK

            you can only hide a dialog if you have already created it. A simple way is to only create a dialog if it has to be shown :-O

            Press F1 for help or google it. Greetings from Germany

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            KarstenK wrote:

            A simple way is to only create a dialog if it has to be shown

            I think the OP wants a hidden dialog. :)

            “Follow your bliss.” – Joseph Campbell

            1 Reply Last reply
            0
            • J john5632

              Hi, How to hide the dialogbox in win32. I tried ShowWindow(hWnd,0) in Initdialog()but fails to hide.

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

              If you are using MFC, see the first part of this article.

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Man who follows car will be exhausted." - Confucius

              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