FIX: Dismissing Splash Screen from Component Causes AssertionLast reviewed: September 18, 1997Article ID: Q138830 |
4.00
WINDOWS NT
kbui kbbuglist kbfixlist kbcode
The information in this article applies to:
SYMPTOMSDismissing a Splash Screen Component inserted from the Component Gallery results in an Assertion failure in Wincore.cpp on line 863. This happens only when you try to dismiss the splash screen early by clicking on a mouse button or pressing a key on the keyboard.
CAUSEFollowing is part of the code inserted by the component that is relevant to this problem:
CWinApp derived class' PreTranslateMessage: BOOL CMyApp::PreTranslateMessage(MSG* pMsg) { CSplashWnd::PreTranslateAppMessage(pMsg); return CWinApp::PreTranslateMessage(pMsg); }The CSplashWnd::PreTranslateAppMessage() looks like this:
void CSplashWnd::PreTranslateAppMessage() { if (c_pSplashWnd == NULL) return; if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN || pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_RBUTTONDOWN || pMsg->message == WM_MBUTTONDOWN || pMsg->message == WM_NCLBUTTONDOWN || pMsg->message == WM_NCRBUTTONDOWN || pMsg->message == WM_NCMBUTTONDOWN) { c_pSplashWnd->HideSplashScreen(); } } void CSplashWnd::HideSplashScreen() { DestroyWindow(); AfxGetMainWnd()->UpdateWindow(); }If a key is pressed while the splash screen is displayed, HideSplashScreen() is called, which destroys the window. When the PreTranslateAppMessage() function returns, CWinApp::PreTranslateMessage() is called for the message when its window has been destroyed already.
RESOLUTIONThis problem can be avoided by not calling CWinApp::PreTranslateMessage() if the splash screen window has alaredy been destroyed. Make the following modifications to accomplish this:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 4.1.
|
Additional reference words: 4.00 4.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |