int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)//这里出的错
        return -1;
错误现象是:Unhandled exception in mytext.exe:0xC0000005 access violation各位,这是回是什么情况造成的? 该怎么办啊???

解决方案 »

  1.   

    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)这一句的前面还有什么代码吗?
    感觉不是这里的错误,而是其它的地方内存操作有误
      

  2.   

    是不是LoadFrame的时候资源ID给错了
      

  3.   

    前面没有代码...init中的代码我也注释了,但还是要报错wincore.cpp中的错误到了这里 CATCH_ALL(e)
    {
    lResult = AfxGetThread()->ProcessWndProcException(e, &pThreadState->m_lastSentMsg);
    TRACE1("Warning: Uncaught exception in WindowProc (returning %ld).\n",
    lResult);
    DELETE_EXCEPTION(e);
    }
      

  4.   

    不好意思,我 对MFC的流程不太清楚,这是init和create的代码,感觉没什么特别的,麻烦看一下。感谢感谢!!!BOOL MytextApp::InitInstance()
    {
    AfxEnableControlContainer();
    #ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings();  // Load standard INI file options (including MRU)

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CMytextDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    NULL);
    AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
    return FALSE; // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
    m_pMainWnd->UpdateWindow(); return TRUE;
    }int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)//这里出的错误
    return -1;
      

  5.   

    CMainFrame::CMainFrame()的代码贴出来看一下