1

に GUI アプリケーションがありMFCます。何らかの理由で、Visual Studio のリリースおよびデバッグ モードでは問題なく動作しますが.exe、ダブルクリックで起動するとクラッシュします。

Visual Studio でホストされている場合は完全に正常に動作するため、このエラーがどこにあるのかわかりません。必死になって、すべての最適化ルーチンを無効にしましたが、効果がないようです。

OSWin 7IDEですVS 2010

障害のあるモジュールは ですがntdll.dll、それが本当の問題かどうかは疑わしいです...

編集 -

デバッガーをクラッシュに接続すると、次の問題が表示されますLoadFrame()

BOOL CAAUserInterfaceDllConsumerApp::InitInstance()
{
    // InitCommonControlsEx() is required on Windows XP if an application
    // manifest specifies use of ComCtl32.dll version 6 or later to enable
    // visual styles.  Otherwise, any window creation will fail.
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    // Set this to include all the common control classes you want to use
    // in your application.
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinAppEx::InitInstance();


    EnableTaskbarInteraction(FALSE);

    // AfxInitRichEdit2() is required to use RichEdit control   
    // AfxInitRichEdit2();

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need
    // Change the registry key under which our settings are stored
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    DWORD isApprunning = 0;

    m_hStartMutex = CreateSemaphore(NULL,
                                    1,
                                    1,
                                    _T("Something"));

    if (GetLastError() ==  ERROR_ALREADY_EXISTS)
    {
        // I dont want to start !
        return FALSE;
    }

    InitContextMenuManager();

    InitKeyboardManager();

    InitTooltipManager();
    CMFCToolTipInfo ttParams;
    ttParams.m_bVislManagerTheme = TRUE;
    theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
        RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

    // To create the main window, this code creates a new frame window
    // object and then sets it as the application's main window object
    CMainFrame* pFrame = new CMainFrame;
    if (!pFrame)
        return FALSE;
    m_pMainWnd = pFrame;
    // create and load the frame with its resources
    pFrame->LoadFrame(IDR_MAINFRAME,
        WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
        NULL);
      .//more stuff
}

これは以下を呼び出します:

BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) 
{
    // base class does the real work

    //if (!CFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
    if (!CFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
    {
        return FALSE;
    }

そして、ここが Visual Studio 以外で失敗する場所です。

与えられた例外は :The activation context being deactivated is not the most recently activated oneです。

私は周りを検索して、次のことを試しました。つまり、 allExceptionsを throw に設定して、処理された例外をキャッチし、 に設定afxAmbientActCtxしましFALSEたが、うまく実行できませんでした。これexeは以前は問題なく動作していました。

親切なアドバイス。

4

0 に答える 0