IMAPIProp::GetLastError

The IMAPIProp::GetLastError method returns a MAPIERROR4GS6AI structure containing information about the previous error.

Quick Info

See IMAPIProp : IUnknownHP08HX.

HRESULT GetLastError(

    HRESULT hResult,

 

    ULONG ulFlags,

 

    LPMAPIERROR FAR * lppMAPIError

 

   )

 

 

Parameters

hResult

[in] HRESULT data type containing the error code generated in the previous method call.

ulFlags

[in] Bitmask of flags that indicates the format for the text returned in the MAPIERROR4GS6AI structure pointed to by lppMAPIError. The following flag can be set:

MAPI_UNICODE

The strings should be in the Unicode format. If the MAPI_UNICODE flag is not set, the strings should be in the ANSI format.

lppMAPIError

[out] Pointer to a pointer to the MAPIERROR structure containing version, component, and context information for the error. The lppMAPIError parameter can be set to NULL if there is no error information to return.

 

Return Values

S_OK

The error information was returned.

MAPI_E_BAD_CHARWIDTH

Either the MAPI_UNICODE flag was set and the implementation does not support Unicode, or MAPI_UNICODE was not set and the implementation only supports Unicode.

 

Remarks

The IMAPIProp::GetLastError method supplies information about a prior method call that failed. Clients can provide their users with detailed information about the error by including the data from the MAPIERROR structure in a dialog box.

All of the implementations of GetLastError provided by MAPI are ANSI implementations except for the IAddrBook implementation. The GetLastError method included with IAddrBook supports Unicode on Windows NT platforms only.

Notes to Callers

You can make use of the MAPIERROR structure pointed to by the lppMAPIError parameter, if GetLastError supplies one, only if the return value is S_OK. Sometimes GetLastError cannot determine what the last error was or has nothing more to report about the error. In this situation, a pointer to NULL is returned in lppMAPIError instead.

To release the memory for the MAPIERROR structure, call MAPIFreeBuffer16U06F.

For more information about the GetLastError method, see Using Extended Errors163ZUX..

See Also

MAPIERROR, MAPIFreeBuffer