SetLastError - Set the current thread's last error code value

Top  Previous  Next

Syntax

SetLastError( <nErrorCode> )

Parameters

<nErrorCode>

 

The last error code to be set for the calling thread.

Return value

Always NIL.

Description

SetLastError is a substitute for the SetLastError function exported by kernel32.dll for applications using Cockpit. It sets the error code for the calling thread as if it was set during a DllExecuteCallEx call. This error code can be retrieved with GetLastError. For transparency reasons SetLastError also calls the SetLastError function exported by kernel32.dll.

Classification

Core

Category

Error Handling

Quick Info

Library: cckptcor.lib / cckptcor.dll

See also

GetLastError, DllExecuteCallEx

Example

 

#INCLUDE "CockpitCoreLibs.ch"

 

FUNCTION Main

 

* Set the last error code

SetLastError(250)

 

* Show it

? GetLastError()

 

RETURN NIL