Click to See Complete Forum and Search --> : DestroyWindow in Splash Screen


Steve McNeese
April 20th, 1999, 07:51 AM
I incorporated the VC++ splash screen code in my applciation. When the timer runs out, it calls HideSplashScreen() which call DestroyWindow(). The DestroyWindow is giving me an Assertion failure. I think this is due to the fact that the main window frame has not drawn by the time the splash destroys itself. I have inserted a dialog that prompts for DB logon information before the app draws it's main window. If the splash times out before information is entered in the dialog which allows the main window to be created, I get the assertion failure. If you do enter the info and the main window draws before the timeout, everything works.

The assertion failure is because the window does not exists I think. Here is the inline code:


_AFXWIN_INLINE LRESULT CWnd::SendMessage(UINT message, WPARAM wParam, LPARAM lParam)
{ ASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd, message, wParam, lParam); }




Is there a way to check for the main window in the HideSplashScreen method? If it does not exists, set a new timer event which will wait and then call HideSplashScreen again.

Thanks for any info,

Steve

Steven M. McNeese
steven.mcneese@boeing.com

Safai Ma
April 20th, 1999, 10:44 PM
You can use AfxGetMainWnd() and check whether the CWnd* returned is NULL or not.

Safai