在這裡我首先要感謝劉晨龍經理, 他在我工作上的支援,做人不能忘本.
1. 對InitInstance重新處理
BOOL CStartupHideDialogApp::InitInstance()
{
//CStartupHideDialogDlg dlg;
//m_pMainWnd = &dlg;
//INT_PTR nResponse = dlg.DoModal();
//if (nResponse == IDOK)
//{
//}
//更改為如下:
CStartupHideDialogDlg dlg;
if(dlg.Create( CStartupHideDialogDlg::IDD ))
{
//dlg.ShowWindow( SW_SHOW );
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.RunModalLoop();
}
return FALSE;
}
2. 將對話方塊屬性Visable更改為False
3. BOOL CStartupHideDialogDlg::OnInitDialog()
{
//CDialog::OnInitDialog(); //注釋掉此句
//change to this method. 下面其它對CDialog::OnInitDialog()部分的重載,具體您可以跟蹤下
//OnInitDialog和處理方法, 其中有個變數會一直會返回TRUE, 而變數為TRUE時, 就會調用
//ShowWindow(SW_SHOW)顯示出來.
BOOL bDlgInit;
if (m_lpDialogInit != NULL)
bDlgInit = ExecuteDlgInit(m_lpDialogInit);
else
bDlgInit = ExecuteDlgInit(m_lpszTemplateName);
if (!bDlgInit)
{
TRACE(traceAppMsg, 0, _T("Warning: ExecuteDlgInit failed during dialog init./n"));
EndDialog(-1);
return FALSE;
}
// transfer data into the dialog from member variables
if (!UpdateData(FALSE))
{
TRACE(traceAppMsg, 0, _T("Warning: UpdateData failed during dialog init./n"));
EndDialog(-1);
return FALSE;
}
SHINITDLGINFO shidi;
ZeroMemory(&shidi, sizeof(SHINITDLGINFO));
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU;
shidi.hDlg = m_hWnd;
AYGSHELL::SHInitDialog(&shidi);
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
return TRUE; // return TRUE unless you set the focus to a control
}