How to: Hiding an MFC dialog box without taskbar / flickering etc
If you show your dialog using
CDialog::DoModal() the framework will make sure your dialog is shown. There is only one way to prevent a modal dialog from being shown:
In your MFC Project dialog e.g. CHiddenDialog.cpp
BEGIN_MESSAGE_MAP(CHiddenDialog, CDialog)
ON_WM_WINDOWPOSCHANGING()
END_MESSAGE_MAP()
BOOL CHiddenDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_visible = FALSE;
return TRUE;
}
void CHiddenDialog::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
{
if (!m_visible)
lpwndpos->flags &= ~SWP_SHOWWINDOW;
CDialog::OnWindowPosChanging(lpwndpos);
}
in your header file CHiddenDialog.h
void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);