I call methods on the WMI / WBEM interfaces that return HRESULTS. I want to show meaningful error messages for these error codes to the user. However, when I look at the HRESULT error message, I get lines such as "IDispatch error # 3598".
Can I find a list of these IDispatch error codes that explain their meaning?
Sample code in which errors may occur:
IWbemLocator *pLocator = NULL;
IWbemServices *pNamespace = NULL;
hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLocator);
if (FAILED(hr))
return hr;
hr = pLocator->ConnectServer(wPath, NULL, NULL, NULL, 0, NULL, NULL, &pNamespace);
if(FAILED(hr))
return hr;
Search for errors:
CString sMessage = _com_error(nError).ErrorMessage();
Note: This does not help - it does not contain the HRESULTS that I receive. They are also not contained in winerror.h.
source
share