locked
VS2010 Run-time Error

    Question

  • Hello,

    I am developing an MFC application using VS2010.
    However, I get a run-time error, when I build the
    application on a different computer.

    Scenario 1:
      Computer A: WinXp
         Builds and Runs OK.
      Computer B: Runs OK.

    Scenario 2:
      Computer B: Windows 7
         Builds OK.
         Run Fails (Run-time Error)

    Error Message:
    File f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\filelist.cpp
    Line:255
     
    BTW, I don't have an "f:" drive on either computer?

    How can I check the "global" VS2010 settings?
    So, that I can try and compare the settings from both
    computers.

    TIA,
    jrcii

    • Edited by jrcii Wednesday, August 25, 2010 6:57 PM
    Wednesday, August 25, 2010 6:25 PM

Answers

  • Hello

    I solved the problem. I created a "Dummy" MFC application.
    I copied the ::InitInstance from the "Dummy" application to
    My Application, and the problem was resolved.

    I am not sure, what was wrong with the ::InitInstance that I was
    using initially?

    jrcii

    • Marked as answer by jrcii Wednesday, August 25, 2010 9:54 PM
    Wednesday, August 25, 2010 9:54 PM

All replies

  • you can ignore the fact that the path shows "f:".  That's just a side-effect of how the Visual C++ team builds their libraries before shipping them.  It's actually the path to where the source files were located when the DLLs were built.  The actual source code is at

    C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc

    (or Program Files (x86) on a 64 bit machine)

    Now to your problem.  I believe if you look around 255 of filelist.cpp you can see it's related to the new handling of the IShellItem handling for Windows 7 (recent file list using SHAddToRecentDocs) but it's hard to tell for sure.   I would need to see the values in a debugger, also showing the stack at the time of failure.

    Wednesday, August 25, 2010 6:55 PM
  • Hello Ted,

    Thank you for replying to my posting

    -------------------------

    CallStack


    MyApp.exe!CRecentFileList::Add(const char * lpszPathName, const char * lpszAppID)  Line 225 + 0x25 bytes C++
    MyApp.exe!CWinApp::AddToRecentFileList(const char * lpszPathName)  Line 84 C++
    MyApp.exe!CDocument::SetPathName(const char * lpszPathName, int bAddToMRU)  Line 296 C++
    MyApp.exe!CSingleDocTemplate::OpenDocumentFile(const char * lpszPathName, int bAddToMRU, int bMakeVisible)  Line 197 C++
    MyApp.exe!CDocManager::OpenDocumentFile(const char * lpszFileName, int bAddToMRU)  Line 1068 C++
    MyApp.exe!CDocManager::OpenDocumentFile(const char * lpszFileName)  Line 977 C++
    MyApp.exe!CWinApp::OpenDocumentFile(const char * lpszFileName)  Line 90 C++
    MyApp.exe!CWinApp::ProcessShellCommand(CCommandLineInfo & rCmdInfo)  Line 43 + 0x1c bytes C++
    MyApp.exe!CMainApp::InitInstance()  Line 89 + 0xc bytes C++
    MyApp.exe!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow)  Line 37 + 0xd bytes C++
    MyApp.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow)  Line 26 C++
    MyApp.exe!__tmainCRTStartup()  Line 275 + 0x2c bytes C
    MyApp.exe!WinMainCRTStartup()  Line 189 C

    ------------------------

    Auto variables

    &psi 0x0036f0a4 {0x00000000} ATL::CComPtr<IShellItem> *
    IID_IShellItem {IID_IShellItem} _GUID
    afxGlobalData {m_bUseSystemFont=0 m_bInSettingChange=0 hbrBtnHilite=0x01100075 ...} AFX_GLOBAL_DATA
    hr 0x80070002 The system cannot find the file specified.  HRESULT
    this 0x00246768 {m_nSize=4 m_arrNames=0x002467cc "D:\MyApp\$1" m_strSectionName="Recent File List" ...} CRecentFileList * const
    __vfptr 0x016a0580 const CRecentFileList::`vftable' *
    m_nSize 4 int
    m_arrNames 0x002467cc "D:\MyApp\$1" ATL::CStringT<char,StrTraitMFC<char,ATL::ChTraitsCRT<char> > > *
    m_strSectionName "Recent File List" ATL::CStringT<char,StrTraitMFC<char,ATL::ChTraitsCRT<char> > >
    m_strEntryFormat "File%d" ATL::CStringT<char,StrTraitMFC<char,ATL::ChTraitsCRT<char> > >
    m_nStart 0 unsigned int
    m_nMaxDisplayLength 30 int
    m_strOriginal "" ATL::CStringT<char,StrTraitMFC<char,ATL::ChTraitsCRT<char> > >

    -------------------------------------

    When, I don't pass in a file name (in the debugger) the program runs OK.
    Unfortunately, I need to pass in a file name.

    How do I disable the MRU stuff?

    jrcii

    Wednesday, August 25, 2010 7:23 PM
  • Hello

    I solved the problem. I created a "Dummy" MFC application.
    I copied the ::InitInstance from the "Dummy" application to
    My Application, and the problem was resolved.

    I am not sure, what was wrong with the ::InitInstance that I was
    using initially?

    jrcii

    • Marked as answer by jrcii Wednesday, August 25, 2010 9:54 PM
    Wednesday, August 25, 2010 9:54 PM
  • Hi

     

    I have the same problem now, my application can run without this error on XP, but on Windows 7.

    What i found is if no chinese charactors in  my full file's path name it works fine. When i trace into that listfile.cpp file, i found after A2W, the chinese charactors in my path name crushed, and after this, that error happens.

    Is something wrong with A2W on Windows 7.

     

    I did something like Jrcii, but it didn't help.

     

    Chen

    Tuesday, September 21, 2010 5:14 PM
  • Hmmm... they have bugs everywhere...

    Do this, just before your CWinApp::InitInstance(); put a CoInitialize(NULL);

    Really scares me when they missed that kind of thing...

     

    Thursday, November 04, 2010 5:56 AM