# 2.1.4.1.8 GetLastError

## Description

Retrieves the calling thread's last-error code value. The last-error code is maintained on a per-thread basis. Multiple threads do not overwrite each other's last-error code.

## Syntax

DWORD GetLastError( )

## Parameters

This function has no parameters.

## Return

The return value is the calling thread's last-error code.

## Remark

Functions executed by the calling thread set this value by calling the SetLastError function. You should call the GetLastError function immediately when a function's return value indicates that such a call will return useful data. That is because some functions call SetLastError with a zero when they succeed, wiping out the error code set by the most recently failed function.