Article ID: 172336
Article Last Modified on 6/3/2005
BOOL CTipApp::InitInstance()
{
...
if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) // Display splash screen.
return FALSE;
m_pMainWnd = pMainFrame;
...
if (!ProcessShellCommand(cmdInfo)) // Handle FileDDE or FileOpen
return FALSE;
...
pMainFrame->ShowWindow(m_nCmdShow);
...
ShowTipAtStartup(); // Display Tip of the Day dialog box.
...
}
When an MFC application is launched from opening a document from the
Explorer, the shell sends a DDE message to the MFC application and the shell
command line information contains a DDE flag. This flag sets m_nCmdShow to
FALSE so that the window can be shown later when the DDE message is processed
by CDocManager::OnDDECommand(). This allows the Splash Screen to be the last
activated window, so the Tip of the Day dialog box is parented off of
it.
void CSplashWnd::HideSplashScreen()
{
// Destroy the window, and update the mainframe.
DestroyWindow();
AfxGetMainWnd()->UpdateWindow();
AfxGetMainWnd()->PostMessage(WM_COMMAND, CG_IDS_TIPOFTHEDAY);
}
(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by
Adam Kim, Microsoft Corporation Keywords: kbtshoot kbuidesign kbprb kbwizard KB172336