Wednesday, March 12, 2008

How to hide application at startup? VC++

It seems this->ShowWindow(SW_HIDE) doesnot work for C++ program when it is put under OnInitDialog.

Here is the way to do it.

Step 1: define a message and function at header file:

#define MY_MESSAGE WM_USER+123

void FuncHideWindow();

Step 2: Add message to message loop


and delcare function:
void CKeyBoardHookTestDlg::FuncHideWindow()

Step 3: post message at OnInitDialog immediately after CDialog::OnInitDialog();


No comments: