SetThreadErrorMode function (errhandlingapi.h)
Controls whether the system will handle the specified types of serious errors or whether the calling thread will handle them.
Syntax
BOOL SetThreadErrorMode(
[in] DWORD dwNewMode,
[out] LPDWORD lpOldMode
);
Parameters
[in] dwNewMode
The thread error mode. This parameter can be one or more of the following values.
Value | Meaning |
---|---|
|
Use the system default, which is to display all error dialog boxes. |
|
The system does not display the critical-error-handler message box. Instead, the system sends the error to the calling thread.
Best practice is that all applications call the process-wide SetErrorMode function with a parameter of SEM_FAILCRITICALERRORS at startup. This is to prevent error mode dialogs from hanging the application. |
|
The system does not display the Windows Error Reporting dialog. |
|
The OpenFile function does not display a message box when it fails to find a file. Instead, the error is returned to the caller. This error mode overrides the OF_PROMPT flag. |
[out] lpOldMode
If the function succeeds, this parameter is set to the thread's previous error mode. This parameter can be NULL.
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
Each process has an associated error mode that indicates to the system how the application is going to respond to serious errors. A thread inherits the error mode of the process in which it is running. To retrieve the process error mode, use the GetErrorMode function. To retrieve the error mode of the calling thread, use the GetThreadErrorMode function.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 R2 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | errhandlingapi.h (include Windows.h) |
Library | Kernel32.lib |
DLL | Kernel32.dll |