MS C++ executable just started failing

  • Thread starter Thread starter Dick Stone
  • Start date Start date
D

Dick Stone

Guest
I suddenly have a failure on an application has been working for 15 years, and the executable has not been recompiled for the last 6 months.

I am using:
1. Operating System: Windows 10
2. Compiler: Microsoft Visual Studio 2010
3. Code: Microsoft C++ MFC SDK

Suddenly, all saves fail in a Microsoft procedure CRecentFileList [see Microsoft code below]. It doesn't fail until after a print to screen. This is true of executables from 6 months ago that have been working un until now. and happens on different Windows 10 machines.

Questions:
1. Is there any way to fix this?
2. If I can't fix it, can I eliminate: ENSURE(SUCCEEDED(hr)); Add(psi, strAppID); so that it doesn't fail?
3. I tried this, and it doesn't recognize that I changed it. How do I get the compiler to recompile and recognize that I chaned filelist.cpp?
4. Would it help to go to Microsoft Visual Studio 2015?

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


MICROSOFT CODE WITH CALL....

The failure is in the code below.

Fails in call to afxGlobalData.ShellCreateItemFromParsingName below.
Returns: hr = 0x800401f0 CoInitialize has not been called. (normally hr==S_OK)
Called with: lpWPath = 0x00a5eee0 "C:\winfree\_small.fre"


filelist.cpp:
void CRecentFileList::Add(LPCTSTR lpszPathName, LPCTSTR lpszAppID)
{
if (!afxGlobalData.bIsWindows7)
{
Add(lpszPathName);
return;
}

CString strAppID = lpszAppID == NULL ? _T("") : lpszAppID;

#if (WINVER >= 0x0601)
ASSERT(AfxIsValidString(lpszPathName));

Add(lpszPathName);

HRESULT hr = S_OK;
CComPtr<IShellItem> psi = NULL;

#ifdef UNICODE
hr = afxGlobalData.ShellCreateItemFromParsingName(lpszPathName, NULL, IID_IShellItem, reinterpret_cast<void**>(&psi));
#else
{
USES_CONVERSION;
LPOLESTR lpWPath = A2W(lpszPathName);
hr = afxGlobalData.ShellCreateItemFromParsingName(lpWPath, NULL, IID_IShellItem, (LPVOID*)&psi); <---------------------- Point of failure
}
#endif

ENSURE(SUCCEEDED(hr));

Add(psi, strAppID);
#endif
}

Continue reading...
 
Back
Top