EXCEPINFO

Describes an exception that occurred during IDispatch::Invoke. For more information on exceptions, see "IDispatch::Invoke" in Chapter 5, "Dispatch Interface and API Functions."

typedef struct FARSTRUCT tagEXCEPINFO {
    unsigned short wCode;        // An error code describing the error.
    unsigned short wReserved;
    BSTR bstrSource;                // Source of the exception.
    BSTR bstrDescription;        // Textual description of the error.
    BSTR bstrHelpFile;            // Help file path.
    unsigned long dwHelpContext;    // Help context ID.
    void FAR* pvReserved;
    // Pointer to function that fills in Help and description info.
    HRESULT (STDAPICALLTYPE FAR* pfnDeferredFillIn)
            (struct tagEXCEPINFO FAR*);
    RETURN VALUE return value;    // A return value describing the error.
} EXCEPINFO, FAR* LPEXCEPINFO;
 

The following table describes the fields of the EXCEPINFO structure.

Field name Type Description
wCode unsigned short An error code identifying the error. Error codes should be greater than 1000. Either this field or the return value field must be filled in; the other must be set to 0.
wReserved unsigned short Reserved; should be set to 0.
bstrSource BSTR A textual, human-readable name of the source of the exception. Typically, this is an application name. This field should be filled in by the implementor of IDispatch.
BstrDescription BSTR A textual, human-readable description of the error intended for the customer. If no description is available, use Null.
bstrHelpFile BSTR The fully qualified drive, path, and file name of a Help file with more information about the error. If no Help is available, use Null.
dwHelpContext unsigned long The Help context ID of the topic within the Help file. This field should be filled in if and only if the bstrHelpFile field is not Null.
pvReserved void FAR* Must be set to Null.
PfnDeferredFillIn STDAPICALLTYPE Pointer to a function that takes an EXCEPINFO structure as an argument and returns an HRESULT value. If deferred, fill-in is not desired, this field should be set to Null.
scode SCODE A return value describing the error. Either this field or wCode (but not both) must be filled in; the other must be set to 0. (16-bit versions only)

Use the pfnDeferredFillIn field to allow an object to defer filling in the bstrDescription, bstrHelpFile, and dwHelpContext fields until they are needed. This field might be used, for example, if loading the string for the error is a time-consuming operation. To use deferred fill-in, the object puts a function pointer in this slot and does not fill any of the other fields except wCode, which is required.

To get additional information, the caller passes the EXCEPINFO structure back to the pexcepinfo callback function, which fills in the additional information. When the ActiveX object and the ActiveX client are in different processes, the ActiveX object calls pfnDeferredFillIn before returning to the controller.