VS2010 LoadFrame fails with error 1401in release m

2019-08-11 11:38发布

问题:

I have this code :

CMainFrame* pFrame = NULL;
    fsnew1 (pFrame, CMainFrame);
    m_pMainWnd = pFrame;     

    if (FALSE == pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL))
    {
      DWORD err = GetLastError();// error code 1401 is returned
        return FALSE;
    }

In debug mode the if condition is false and so no error is there and my dialog frame gets loade successfully. But in release mode if condition gets true as LoadFrame returns false and frame never gets loaded.

What may be the issue?

回答1:

As requested in the comments...

The .res and .aps files are a by-product of resource compilation. It's not unusual for them to get out of sync with what's actually in the .rc file especially if modifications are made manually and not through the resource editor. Deleting those files will force the resource compiler to rebuild them and thus put them back in sync