在MFC的示例开始会创建模态对话框,然后进行一系列的初始化.最终会在屏幕上显示对话框出来。
但有时候启动程序时,是不想见到对话框的.这种隐藏窗口方式启动方法如下
BOOL XXXXDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ModifyStyleEx(WS_EX_APPWINDOW,WS_EX_TOOLWINDOW);//从任务栏中去掉.
SetWindowPos(&wndTop,0,0,0,0,NULL);
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
现在看不到程序了吧,其实它在后台跑着