Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function sets the last-error code for the calling thread.
void SetLastError( DWORD dwErrCode );
Parameters
Return Values
None.
Remarks
Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for application-defined error codes; no system error code has this bit set. If you are defining an error code for your application, set this bit to indicate that the error code has been defined by your application and to ensure that your error code does not conflict with any system-defined error codes.
This function is intended primarily for dynamic-link libraries (DLLs). Calling this function after an error occurs lets the DLL emulate the behavior of a Win32 function.
Most Win32 functions call SetLastErrorwhen they fail. Function failure is typically indicated by a return value error code such as FALSE, NULL, 0xFFFFFFFF, or –1. Some functions call SetLastErrorunder conditions of success; those cases are noted in each function's reference page.
Applications can retrieve the value saved by this function by using the GetLastErrorfunction. The use of GetLastErroris optional; an application can call it to find out the specific reason for a function failure.
The last-error code is kept in thread local storage so that multiple threads do not overwrite each other's values.
Requirements
Runs On | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winbase.h | Coredll.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also