Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > CoCreateInstance fails with unknown error

CoCreateInstance fails with unknown error

Forum Windows XP : Windows XP General Discussion - CoCreateInstance fails with unknown error

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

Hi!

I have created a ActiveX control which works in all PCs except two on client's location. I have narrowed down the problem to failure of CoCreateInstance() which fails with unknown error.

What could cause this problem?

Please see the code below:

try
{

CComPtr<IDispatch> lpTDispatch;
//Following line generates an exception
HRESULT hr = lpTDispatch.CoCreateInstance(_bstr_t("XBrowseInvokerBean.Bean.1" ));

//Code does not reach to following line.
DWORD lasterror = GetLastError();
logFile->Write(CString("GetLastError : %u" ), lasterror);
logFile->Write(CString("HRESULT Value: %X" ), hr);
}
catch(CException *e)
{
//Exception does not get caught in this catch

LPSTR strError ="";
e->GetErrorMessage(strError,MAX_PATH);
logFile->Write("Exception:"+CString(strError));
CoUninitialize();
}
catch (_com_error e)
{
//Exception does not get caught in this catch
CString err2 = _com_error(HRESULT_FROM_WIN32(GetLastError())).ErrorMessage();
logFile->Write("COM ERROR2:"+CString(err2));
CoUninitialize();
}
catch(...)
{
//Exception get caught in this catch, Value returned is 0.

logFile->Write("Unknown exception occurred:%X",
HRESULT_FROM_WIN32(GetLastError()));
CoUninitialize();
}

Sponsored Links
Register or log in to remove.
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > CoCreateInstance fails with unknown error
Go to:

There are 586 identified and unidentified users. To see the list of identified users, Click here.

Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them