Win32 DialogBox app: how to make a dialog box hidden at startup?

I have a win32 application that uses DialogBox () to display its main window.

Now I want to run this application with an invisible dialog box, and later install it using SetWindowPos (hDlg, HWND_TOPMOST, ...

Unfortunately

http://msdn.microsoft.com/en-us/library/ms645452(VS.85).aspx

The function displays a dialog box (regardless of whether the template sets the WS_VISIBLE style)

... it seems that there is no way to do this with DialogBox ().

I could add a call to SetWindowPos (hDlg, HWND_NOTOPMOST ...

in my dialog procedure in the WM_INITDIALOG handler.

... but I'm worried that when the system boots up intensively, the dialog box will appear briefly and then disappear, which gives an ugly flicker effect.

DialogBox(), ?

+3
2
+1

void CMyDlg::OnWindowPosChanging(WINDOWPOS* lpWndPos)
{
    // hide dialog
    lpWndPos->flags &= ~SWP_SHOWWINDOW;
    CDialog::OnWindowPosChanging(lpWndPos);
}

0

Source: https://habr.com/ru/post/1771755/


All Articles