Skip to content

Latest commit

 

History

History
123 lines (85 loc) · 2.69 KB

usesgetlasterror.md

File metadata and controls

123 lines (85 loc) · 2.69 KB
title description ms.assetid keywords topic_type api_name api_type ms.topic ms.date
usesgetlasterror attribute
The \ usesgetlasterror\ attribute signals the caller that it can call GetLastError to retrieve the error code.
8e9ab8b5-f446-4aab-bb40-b6f78799e18e
usesgetlasterror attribute MIDL
apiref
usesgetlasterror
NA
reference
05/31/2018

usesgetlasterror attribute

The [usesgetlasterror] attribute signals the caller that it can call GetLastError to retrieve the error code.

[
    module-attributes
]
module module-name
{
    [entry(entry-id), usesgetlasterror [, other-attributes]] return-type function-name(param-list);
};

Parameters

module-attributes

Zero or more MIDL attributes that will be applied to the module.

module-name

The identifier name of the module.

entry-id

Specifies the module entry point–function name or integer-identification number.

other-attributes

Zero or more MIDL attributes that will be applied to the remote procedure.

return-type

The type of the data that the remote procedure will return upon completion.

function-name

The name of the remote procedure as defined in the IDL file.

param-list

Zero or more parameters to the remote procedure.

Remarks

The [usesgetlasterror] attribute can be set on a module entry point, if that entry point uses the Windows function SetLastError to return error codes. The attribute tells the caller that, if there is an error when calling that function, the caller can then call GetLastError to retrieve the error code.

Examples

[
    dllname("MyOwn.dll")
] 
module MyModule
{
    [entry("One"), usesgetlasterror, bindable, requestedit,
     propputref, defaultbind] HRESULT Func1(
         [in]IUnknown * iParam1, 
         [out] long * Param2) ;
    [entry("TwentyOne"), usesgetlasterror, 
     hidden, vararg] SAFEARRAY (int) Func2(
         [in, out] SAFEARRAY (variant) *varP) ;

    // Other module definition statements.
};

See also

Generating a Type Library With MIDL

ODL File Example

ODL File Syntax