网站首页  词典首页

请输入您要查询的函数:

 

术语 seterrormode
释义 SetErrorMode
语法:
C++
UINT WINAPI SetErrorMode(
__in UINT uMode
);
SetErrorMode功能
控制系统是否会处理的严重错误指定的类型或过程是否会处理。
参数
uMode [in]
该进程的错误模式。此参数可以是一个或多个下列值。
ValueMeaning
0Use系统默认,这是显示所有的错误对话框。
SEM_FAILCRITICALERRORS
0x0001The系统不显示关键错误处理消息框。相反,系统发送错误给调用进程。
SEM_NOALIGNMENTFAULTEXCEPT
0x0004The系统会自动修复故障和内存对齐使他们看不见的应用程序。它为调用进程和任何后代处理此。此功能只支持某些处理器架构。有关详细信息,请参见备注部分。
之后,该值设置为一个过程,后续尝试清除值将被忽略。
SEM_NOGPFAULTERRORBOX
0x0002The系统不显示一般保护错误消息框。此标志应设置只能由调试应用程序,处理一般性保护(GP)与异常处理故障自己。
SEM_NOOPENFILEERRORBOX
0x8000The系统无法显示一个消息框时,无法找到一个文件。相反,错误返回给调用过程。
返回值
返回值是错误的以前的状态,模式位标志。
备注
每个进程都有一个关联的错误模式,指出该系统的应用程序如何去应对严重的错误。子进程将继承父进程的错误模式。若要检索进程的错误模式,使用GetErrorMode功能。
由于错误模式,对整个进程中设置,您必须确保多线程应用程序没有设置不同的错误模式的标志。这样做可能会导致不一致的错误处理。
系统不作调整故障可见对所有处理器的应用架构。因此,指定SEM_NOALIGNMENTFAULTEXCEPT不是在这样的架构,但该系统可免费默默地忽略该请求。这意味着代码,如下面的序列并不总是有效的基于x86的计算机:
SetErrorMode(SEM_NOALIGNMENTFAULTEXCEPT);
fuOldErrorMode = SetErrorMode(0);
断言(fuOldErrorMode == SEM_NOALIGNMENTFAULTEXCEPT);
安腾:应用程序必须显式调用SEM_NOALIGNMENTFAULTEXCEPT SetErrorMode让系统自动修复对齐错误。默认设置是对系统进行调整故障看到一个应用程序。
Visual Studio 2005中:当声明一个指针,可能没有对齐数据结构,您可以使用关键字来__unaligned表明,类型必须是一次读取一个字节。有关更多信息,请参阅Windows数据统一。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
错误处理函数
GetErrorMode
过程错误模式
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==SetErrorMode Function
Controls whether the system will handle the specified types of serious errors or whether the process will handle them.
Syntax
C++
UINT WINAPI SetErrorMode(
__in UINT uMode
);
Parameters
uMode [in]
The process error mode. This parameter can be one or more of the following values.
ValueMeaning
0Use the system default, which is to display all error dialog boxes.
SEM_FAILCRITICALERRORS
0x0001The system does not display the critical-error-handler message box. Instead, the system sends the error to the calling process.
SEM_NOALIGNMENTFAULTEXCEPT
0x0004The 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
0x0002The system does not display the general-protection-fault message box. This flag should be set only by debugging applications that handle general protection (GP) faults themselves with an exception handler.
SEM_NOOPENFILEERRORBOX
0x8000The 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 .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Error Handling Functions
GetErrorMode
Process Error Mode
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:21:04