I get a Debug Assertion Failure with the standard "Abort, Retry, Ignore" options as soon as I run my program. The problem is reported on line 301 of winocc.cpp.
Using debugger, I found that the m_pMainWnd->ShowWindow() call is where the ASSERT is that is failing - it seems as though the window is not valid. This is the CMainWin constructor:Code:class CMyApp : public CWinApp { public: BOOL InitInstance() { m_pMainWnd = new CMainWin; // see note below - this is the failure m_pMainWnd->ShowWindow( m_nCmdShow ); m_pMainWnd->UpdateWindow(); return TRUE; } } MyApp;
With that segment "as is," it fails. If I remove the last parameter (the menu name), it works (but I get no menu, which is rather important). The appropriate lines from the resource file:Code:CMainWin::CMainWin() { Create( NULL, "CanOutData", WS_OVERLAPPEDWINDOW, CRect( 0,0,300,100 ), NULL, "IDR_MAINMENU" ); }
That's it. I've tried to post all the relevant code. Based on some web searching I did, it seemed as though the menu name was wrong, but it doesn't appear so. Can anybody provide any other suggestions on what might be causing the problem? TIACode:IDR_MAINMENU MENU BEGIN POPUP "&File" BEGIN MENUITEM "&New...", ID_FILE_NEW MENUITEM SEPARATOR MENUITEM "E&xit", ID_FILE_EXIT END POPUP "&Help", HELP BEGIN MENUITEM "A&bout...", ID_HELP_ABOUT END END
Edit: forgot to mention that CMainWin is my own class publicly derived from CFrameWnd.



LinkBack URL
About LinkBacks


