Q: How to start your dialog application in hidden mode?
A: If you put the function 'ShowWindow(SW_HIDE)' in your 'OnInitDialog()', it won't have any effect, because 'OnInitDialog()' always finishes with calling 'ShowWindow(SW_SHOW)'. But there is a workaround for that. Create a 'BOOL' member variable into your dialog class and set it to 'FALSE' in the constructor.
Now override the 'WM_WINDOWPOSCHANGING' message handler. Your code should look something like this to hide the dialog:
class CYourDialog : public CDialog
CYourDialog::CYourDialog(CWnd* pParent /*=NULL*/)
: CDialog(CYourDialog::IDD, pParent)
m_visible = FALSE;
To make the dialog again visible, use the following code:
void CYourDialog::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
lpwndpos->flags &= ~SWP_SHOWWINDOW;
m_visible = TRUE;