[노트] MSDN: SetErrorMode Function
4668 단어 function
Controls whether the system will handle the specified types of serious errors or whether the process will handle them.
Syntax
UINT WINAPI SetErrorMode(
__in UINT uMode
);
Parameters
uMode [in]
The process error mode. This parameter can be one or more of the following values.
Value
Meaning
0
Use the system default, which is to display all error dialog boxes.
SEM_FAILCRITICALERRORS
0x0001
The system does not display the critical-error-handler message box. Instead, the system sends the error to the calling process. 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.
SEM_NOALIGNMENTFAULTEXCEPT
0x0004
The system automatically fixes memory alignment faults and makes them invisible to the application. It does this for the calling process and any descendant processes. This feature is only supported by certain processor architectures. For more information, see the Remarks section. After this value is set for a process, subsequent attempts to clear the value are ignored.
SEM_NOGPFAULTERRORBOX
0x0002
The system does not display the Windows Error Reporting dialog.
SEM_NOOPENFILEERRORBOX
0x8000
The system does not display a message box when it fails to find a file. Instead, the error is returned to the calling process.
Return Value
The return value is the previous state of the error-mode bit flags.
Remarks
Each process has an associated error mode that indicates to the system how the application is going to respond to serious errors. A child process inherits the error mode of its parent process. To retrieve the process error mode, use the GetErrorMode function.
Because the error mode is set for the entire process, you must ensure that multi-threaded applications do not set different error-mode flags. Doing so can lead to inconsistent error handling.
The system does not make alignment faults visible to an application on all processor architectures. Therefore, specifying SEM_NOALIGNMENTFAULTEXCEPT is not an error on such architectures, but the system is free to silently ignore the request. This means that code sequences such as the following are not always valid on x86 computers:
SetErrorMode(SEM_NOALIGNMENTFAULTEXCEPT);
fuOldErrorMode = SetErrorMode(0);
ASSERT(fuOldErrorMode == SEM_NOALIGNMENTFAULTEXCEPT);
Itanium: An application must explicitly call SetErrorMode with SEM_NOALIGNMENTFAULTEXCEPT to have the system automatically fix alignment faults. The default setting is for the system to make alignment faults visible to an application.
Visual Studio 2005: When declaring a pointer to a structure that may not have aligned data, you can use the __unaligned keyword to indicate that the type must be read one byte at a time. For more information, see Windows Data Alignment .
Windows 7:
Callers should favor SetThreadErrorMode over SetErrorMode since it is less disruptive to the normal behavior of the system.
SetErrorMode 함수를 프로그램 앞뒤에 놓으면 시스템이 튀어나오는 것을 방지할 수 있습니다. [2] 내에델파이가 호출한 예 코드가 있습니다.
var
EMode: Word;
begin
EMode := SetErrorMode(SEM_FAILCRITICALERRORS);
// ShFormatDrive Code....
SetErrorMode(EMode);
end;
참조:
Technorati 태그:
Delphi ,
SetErrorMode
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
콜백 함수를 Angular 하위 구성 요소에 전달이 예제는 구성 요소에 함수를 전달하는 것과 관련하여 최근에 직면한 문제를 다룰 것입니다. 국가 목록을 제공하는 콤보 상자 또는 테이블 구성 요소. 지금까지 모든 것이 구성 요소 자체에 캡슐화되었으며 백엔드에 대한 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.