Wednesday, January 25, 2006

AtlReportError

Why havn't I've seen this before?!?

Say you you have received an socket-error:


int socketErr = HOST_NOT_FOUND;
HRESULT hr = MAKE_HRESULT(1, FACILITY_INTERNET, socketErr);
TCHAR *errMsg; // Fill using FormatMessage
hr = AtlReportError(GetObjectCLSID(), errMsg, GUID_NULL, hr);
//Free errMsg
return hr;

An now, when _com_error or VB-Err object are examined, we get textual
messages that make sense!

0 Comments:

Post a Comment

<< Home