debug版本下正常,Release版本下用F5运行,触发以下错误:CMyApp::InitInstance()
{
...
    该函数代码全由MFC自动生成。    //下面这个函数里面出错。 具体位置见后面
    if (!ProcessShellCommand(cmdInfo))
return FALSE;
...
}//具体出错位置
BOOL CWnd::ShowWindow(int nCmdShow)
{
ASSERT(::IsWindow(m_hWnd)); if (m_pCtrlSite == NULL)
return ::ShowWindow(m_hWnd, nCmdShow);
else
return m_pCtrlSite->ShowWindow(nCmdShow); //这句出错
}强烈郁闷中,望指点!保证给分。

解决方案 »

  1.   

    ASSERT(::IsWindow(m_hWnd));
    改成
    VERIFY(::IsWindow(m_hWnd));
    试试看,ASSERT只能在debug下面使用,并且在release版本中就不执行,
    VERIFY可以在release使用,有可能在你的程序的其它位置把一些函数的执行放在了
    ASSERT中,在release时候,就没有执行,所以会出错,检查一下你的代码吧
      

  2.   


    可是这里面没有一句代码是我添加的啊。都是MFC自带或自动生成的代码。在InitInstance()里就出错了。
      

  3.   

    能不能给出你InitInstance()添加的代码啊
      

  4.   

    AkiraChing(水银) :
    我没有往里面添加代码,InitInstance()从classwizard生成工程后我就没动过,刚才我调试了一下,发现在这之前的执行的CMainFrame::Create里面的代码对InitInstance()有影响。还在试。
      

  5.   

    下面出错后的CAll Stack: 大虾们帮帮忙呀CWnd::ShowWindow(CWnd * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}, int 3) line 306
    CFrameWnd::ActivateFrame(CFrameWnd * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}, int 3) line 2095
    CFrameWnd::InitialUpdateFrame(CFrameWnd * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}, CDocument * 0x011d0070 {CMyAppDoc}, int 1) line 762
    CDocTemplate::InitialUpdateFrame(CDocTemplate * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}, CFrameWnd * 0x011ca668 {CMainFrame hWnd=0x003f0e12}, CDocument * 0x011d0070 {CMyAppDoc}, int 1) line 332
    CSingleDocTemplate::OpenDocumentFile(CSingleDocTemplate * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}, const char * 0x00000000, int 1) line 205
    CDocManager::OnFileNew(CDocManager * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}) line 829
    _AfxDispatchCmdMsg(CCmdTarget * 0x00528590 class CMyAppApp  theApp, unsigned int 57600, int 0, void (void)* 0x004c02cf CWinApp::OnFileNew(void), void * 0x00000000, unsigned int 12, AFX_CMDHANDLERINFO * 0x00000000) line 88
    CCmdTarget::OnCmdMsg(CCmdTarget * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}, unsigned int 57600, int 0, void * 0x00000000, AFX_CMDHANDLERINFO * 0x00000000) line 302 + 24 bytes
    CWinApp::ProcessShellCommand(CWinApp * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}, CCommandLineInfo & {CCommandLineInfo}) line 31 + 23 bytes
    CMyAppApp::InitInstance(CMyAppApp * const 0x011ca668 {CMainFrame hWnd=0x003f0e12}) line 111 + 19 bytes
    AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x001334bd, int 1) line 39 + 7 bytes
    WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x001334bd, int 1) line 30
    App! WinMainCRTStartup + 224 bytes
    KERNEL32! 77e67903()