Hiding a Dialog application on first run
-
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 ?
-
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 ?
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 callShowWindow(SW_HIDE)
then the window will be shown afterOnInitDialog()
returns. To solve this you should create your dialog without theWS_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
-
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 ?
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).
-
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 ?
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
-
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 callShowWindow(SW_HIDE)
then the window will be shown afterOnInitDialog()
returns. To solve this you should create your dialog without theWS_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
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
-
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
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
-
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
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.