List of IDispatch errors and / or message texts

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();

// sMessage now contains a string like "IDispatch error #3598"

Note: This does not help - it does not contain the HRESULTS that I receive. They are also not contained in winerror.h.

+3
source share
1 answer

COM HRESULT. IErrorInfo . _com_error , IErrorInfo .

QI ISupportErrorInfo InterfaceSupportsErrorInfo(), , . GetErrorInfo() IErrorInfo. MSDN docs .

+6

Source: https://habr.com/ru/post/1790209/


All Articles