Rich Error Information

Most COM programmers know that COM objects return a data structure called an HRESULT to indicate the status of a method call. If the method is successful, the COM object should return S_OK. If the method fails, the COM object can return any number of pre-defined HRESULTS, such as E_FAIL or E_INVALIDARG, or you can use the MAKE_HRESULT macro to create your own error HRESULTs. Although just returning an HRESULT is sufficient in some cases, in many cases, a client will want a textual description of the error, the name of the method that was the source of the error, and perhaps even a link to a help file that contains additional information about the error. A COM object can return this sort of rich error information to a client ...

Get .NET and COM Interoperability Handbook, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.