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. When must I hide my window???

When must I hide my window???

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
9 Posts 7 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.
  • V Offline
    V Offline
    Vladimir Georgiev
    wrote on last edited by
    #1

    I have a MFC dialog application that has an option to go to the system tray after clicking a button... I also call ShowWindow(false); to hide my application window when I add the icon to the systray. Unfortunately, I want to hide my app immediately after starting it... I try in InitDialog, OnCreate, and it does not happen - the window does not seem to respond to ShowWindow(false). Some help will be highly appreciated, for I am stuck with this problem. "Needless redundancy is the hobgoblin of software engineering." - Peter Darnell

    R F J 3 Replies Last reply
    0
    • V Vladimir Georgiev

      I have a MFC dialog application that has an option to go to the system tray after clicking a button... I also call ShowWindow(false); to hide my application window when I add the icon to the systray. Unfortunately, I want to hide my app immediately after starting it... I try in InitDialog, OnCreate, and it does not happen - the window does not seem to respond to ShowWindow(false). Some help will be highly appreciated, for I am stuck with this problem. "Needless redundancy is the hobgoblin of software engineering." - Peter Darnell

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      ShowWindow (SW_HIDE); /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com

      V 1 Reply Last reply
      0
      • R Ravi Bhavnani

        ShowWindow (SW_HIDE); /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com

        V Offline
        V Offline
        Vladimir Georgiev
        wrote on last edited by
        #3

        Where do I call this? Because at the end of InitDialog it does NOT work... the icon is put in the systray, but ShowWindow (SW_HIDE) does not hide my dialog... Looking forward to suggestions. "Needless redundancy is the hobgoblin of software engineering." - Peter Darnell

        J 1 Reply Last reply
        0
        • V Vladimir Georgiev

          Where do I call this? Because at the end of InitDialog it does NOT work... the icon is put in the systray, but ShowWindow (SW_HIDE) does not hide my dialog... Looking forward to suggestions. "Needless redundancy is the hobgoblin of software engineering." - Peter Darnell

          J Offline
          J Offline
          Jon Hulatt
          wrote on last edited by
          #4

          seen this problem many times, but never found a satisfactory solution. a working solution however, is to create a timer in initdialog, and then hide your app in the timer function, remembering to kill the timer as well. Sorry to dissapoint you all with my lack of a witty or poignant signature.

          1 Reply Last reply
          0
          • V Vladimir Georgiev

            I have a MFC dialog application that has an option to go to the system tray after clicking a button... I also call ShowWindow(false); to hide my application window when I add the icon to the systray. Unfortunately, I want to hide my app immediately after starting it... I try in InitDialog, OnCreate, and it does not happen - the window does not seem to respond to ShowWindow(false). Some help will be highly appreciated, for I am stuck with this problem. "Needless redundancy is the hobgoblin of software engineering." - Peter Darnell

            F Offline
            F Offline
            Felix Cho
            wrote on last edited by
            #5

            Can you POST (not send) yourself a (WM_USER + n) message to your dialog towards the end of OnInitDialog()? However, based on what you are saying here, if your dialog does not need any user input, why create and show the dialog in the first place?

            1 Reply Last reply
            0
            • V Vladimir Georgiev

              I have a MFC dialog application that has an option to go to the system tray after clicking a button... I also call ShowWindow(false); to hide my application window when I add the icon to the systray. Unfortunately, I want to hide my app immediately after starting it... I try in InitDialog, OnCreate, and it does not happen - the window does not seem to respond to ShowWindow(false). Some help will be highly appreciated, for I am stuck with this problem. "Needless redundancy is the hobgoblin of software engineering." - Peter Darnell

              J Offline
              J Offline
              Joaquin M Lopez Munoz
              wrote on last edited by
              #6

              I wrote a post some weeks ago explaining how to make a dialog to start up hidden. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

              N 1 Reply Last reply
              0
              • J Joaquin M Lopez Munoz

                I wrote a post some weeks ago explaining how to make a dialog to start up hidden. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

                N Offline
                N Offline
                Nish Nishant
                wrote on last edited by
                #7

                That's a brilliant solution Joaquín! Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                A 1 Reply Last reply
                0
                • N Nish Nishant

                  That's a brilliant solution Joaquín! Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                  A Offline
                  A Offline
                  Alvaro Mendez
                  wrote on last edited by
                  #8

                  Well, not to take away from the "brilliant"ness of Joaquin's solution, but I thought mine's was better. :-) Regards, Alvaro

                  N 1 Reply Last reply
                  0
                  • A Alvaro Mendez

                    Well, not to take away from the "brilliant"ness of Joaquin's solution, but I thought mine's was better. :-) Regards, Alvaro

                    N Offline
                    N Offline
                    Nish Nishant
                    wrote on last edited by
                    #9

                    :-) Joaquin's solution was for modal dialogs! You solution lies in making the dialog modeless and then entering the CWinApp message loop which is a nice trick too I must say. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                    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