Share via


_com_error::WCode

Microsoft Specific

WORD WCode ( ) const throw( );

Return Value

If the HRESULT is within the range 0x80040200 to 0x8004FFFF, the WCode method returns the HRESULT minus 0x80040200, else it returns zero.

Remarks

The WCode method retrieves a 16-bit error code which has been mapped into the encapsulated HRESULT.

The WCode method is used to undo a mapping which happens in the COM support code. The wrapper for a dispinterface property or method calls a support routine which packages the arguments and calls IDispatch::Invoke. Upon return, if a failure HRESULT of DISP_E_EXCEPTION is returned, the error information is retrieved from the EXCEPINFO structure passed to IDispatch::Invoke. The error code can either be a 16-bit value stored in the wCode member of the EXCEPINFO structure or a full 32-bit value in the scode member of the EXCEPINFO structure. If a 16-bit wCode is returned, it must first be mapped to a 32-bit failure HRESULT.

See Also   _com_error::HRESULTToWCode, _com_error::WCodeToHRESULT, _com_error Overview

END Microsoft Specific