Hide the dilog in dialog based application.
-
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this . Thanks in advance
-
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this . Thanks in advance
vicky00000 wrote:
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this
According to MSDN, the SW_HIDE is ignored during the 1st call when the dialog is about to pop up. ShowWindow[^] The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter. As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in the structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window.
Maxwell Chen
-
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this . Thanks in advance
And the reason is: If it worked, then no target window would receive messages. There is a solution for this: To make your application hide to systray.
Maxwell Chen
-
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this . Thanks in advance
vicky00000 wrote:
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this .
don't call DoModal until you want it to show.
-
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this . Thanks in advance
Override the
OnWindowPosChanging()
method with:if (! m_bVisible) // set to false in the dialog's constructor
lpwndpos->flags &= ~SWP_SHOWWINDOW;CDialog::OnWindowPosChanging(lpwndpos);
Just before calling
ShowWindow(SW_SHOW)
, setm_bVisible
totrue
."Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
vicky00000 wrote:
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup how to avoid this
According to MSDN, the SW_HIDE is ignored during the 1st call when the dialog is about to pop up. ShowWindow[^] The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter. As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in the structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window.
Maxwell Chen
Is there any way to update STARTUPINFO structure ? Thanks for your replay
-
Override the
OnWindowPosChanging()
method with:if (! m_bVisible) // set to false in the dialog's constructor
lpwndpos->flags &= ~SWP_SHOWWINDOW;CDialog::OnWindowPosChanging(lpwndpos);
Just before calling
ShowWindow(SW_SHOW)
, setm_bVisible
totrue
."Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
Thank you very much DavidCrow I solve my problem with the help of you Thanks