GetLastError

  DWORD GetLastError(VOID)    

The GetLastError function returns the most recent error code set by a Win32 function call.

Parameters

This function has no parameters.

Return Value

The return value is the most recent error code set by a Win32 function in the current thread.

Comments

An application should call this function immediately after a Win32 function call fails (typically indicated by returning FALSE, NULL or -1) to determine the cause of the failure.

The last error code value is maintained on a per-thread basis, so multiple threads do not overwrite each other's last error code value.

See Also

SetLastError