Export (0) Print
Expand All
COM
id
in
int
odl
out
ptr
ref
Expand Minimize
This topic has not yet been rated - Rate this topic

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

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.