Re: Hide Frame window on load
Anyone know how to get CDialog::DoModal() to create the dialog as hidden, so
in the OnInitDialog() I can do a MoveWindow() to move and resize the dialog
as desired without the user seeing a flicker? After I do these things, my
dialog can do a ShowWindow(SW_SHOW) to become visible in the correct
location and size.
If you use:
SetWindowPos( NULL, x, y, 0, 0,
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );
in InitDialog, you you still see it flicker?
Here's a method I've seen posted before to keep a dialog hidden:
Add a "visible" flag to the dialog class and initialize it to
FALSE in the constructor.
Add a handler for OnWindowPosChanging.
void CTestDlg::OnWindowPosChanging( WINDOWPOS* lpwndpos )
{
if ( !m_bVisible )
lpwndpos->flags &= ~SWP_SHOWWINDOW ;
CDialog::OnWindowPosChanging(lpwndpos);
}
Add a function to show/hide the app.
void CTestDlg::DisplayWindow( BOOL bShow )
{
if ( bShow )
{
m_bVisible = TRUE;
ShowWindow( SW_SHOWNORMAL );
}
else
{
m_bVisible = FALSE;
ShowWindow( SW_HIDE );
}
}
Dave