I never have a problem with CoInitializeEx myself, after reading MSDN it says:
This function supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:
The COM library was initialized successfully on the calling thread.
The COM library is already initialized on the calling thread.
A previous call to CoInitializeEx specified a different concurrency model for the calling thread, or the thread that called CoInitializeEx currently belongs to the neutral threaded apartment.
so perhaps you are mistaking an "already initialized" return code for an "error" return code.
Here is a function to retrieve an error message from a HRESULT:
CString CApp::GetErrorText(HRESULT hr)
if(FACILITY_WINDOWS == HRESULT_FACILITY(hr))
hr = HRESULT_CODE(hr);
NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&szErrMsg, 0, NULL) != 0)
_stprintf(szErrMsg, _T("Unkown Error: %#x"), hr);