首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

SetErrorMode如何用啊加到哪里

2012-06-21 
SetErrorMode怎么用啊,加到哪里我的程序是MFC的程序,里面调了两个dll,我在框架程序里初始化dialog的地方加

SetErrorMode怎么用啊,加到哪里
我的程序是MFC的程序,里面调了两个dll,我在框架程序里初始化dialog的地方加了SetErrorMode,但是程序还是会崩框,我想问一下,如果不在dll里面也加SetErrorMode,如果dll里面崩了,外面的SetErrorMode管用吗,如果不管用,我加到dll里面应该加到什么位置,如果加了能管用吗

谢谢哈~~

[解决办法]
还是先解决为啥崩溃吧,Debug call stack,看函数调用堆栈
[解决办法]
SetErrorMode() Is Inherited
Last reviewed: November 2, 1995
Article ID: Q105304
The information in this article applies to: 
Microsoft Win32 Application Programming Interface (API) included with: 


- Microsoft Windows NT versions 3.1, 3.5, and 3.51
- Microsoft Windows 95 version 4.0


An application can use SetErrorMode() to control whether the operating system handles serious errors or whether the application itself will handle the errors. 

NOTE: The error mode will be inherited by any child process. However, the child process may not be prepared to handle the error return codes. As a result, the application may die during a critical error without the usual error message popups occurring. 

This behavior is by design. 

One solution is to call SetErrorMode() before and after the call to CreateProcess() in order to control the error mode that is passed to the child. Be aware that this process must be synchronized in a multithreaded application. 

There is another solution available in Windows NT 3.5 and later. CreateProcess() has a new flag CREATE_DEFAULT_ERROR_MODE that can be used to control the error mode of the child process. 

 

热点排行