SEHException的错误处理方法
2006-11-20 17:00
211 查看
我在Application.Run(new MainForm());之前应用了Application.EnableVisualStyles();
程序中有个按钮,Click事件的代码为:
Form1 frm = new Form();
frm.ShowDialog();
程序运行时,点击此按钮,出现了一个窗体,然后关闭此窗体,再点击另一个按钮,又会出现一个窗体,当关闭这个窗体时系统抛出了一个异常:System.Runtime.InteropServices.SEHException,外部组件引发异常。
在Google查了一下,在MSDN的一个blog上发现了解决办法,作者是这个写的:
static void Main()
{
Application.EnableVisualStyles();
new Thread(new ThreadStart(AppRun)).Start();
}
private static void AppRun()
{
Application.Run(new MainForm());
}
具体的原理作者也不清楚,这可能是VS2003应用了Application.EnableVisualStyles();
还有一种可行的方法:
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new MainForm());
原文:http://blog.csdn.net/duncansun/archive/2006/04/08/655250.aspx
程序中有个按钮,Click事件的代码为:
Form1 frm = new Form();
frm.ShowDialog();
程序运行时,点击此按钮,出现了一个窗体,然后关闭此窗体,再点击另一个按钮,又会出现一个窗体,当关闭这个窗体时系统抛出了一个异常:System.Runtime.InteropServices.SEHException,外部组件引发异常。
在Google查了一下,在MSDN的一个blog上发现了解决办法,作者是这个写的:
static void Main()
{
Application.EnableVisualStyles();
new Thread(new ThreadStart(AppRun)).Start();
}
private static void AppRun()
{
Application.Run(new MainForm());
}
具体的原理作者也不清楚,这可能是VS2003应用了Application.EnableVisualStyles();
还有一种可行的方法:
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new MainForm());
原文:http://blog.csdn.net/duncansun/archive/2006/04/08/655250.aspx
相关文章推荐
- ORA-00257 archiver error. 错误的处理方法
- SQL Server数据库错误9003(LSN无效)的处理方法
- Hadoop常见错误及处理方法
- NTLDR is missing 错误处理方法
- identifier 'SYS.DBMS_LOCK' must be declared错误处理方法
- PHP 图片处理类 错误处理方法:
- MSSQL附加数据库拒绝访问提示5120错误的处理方法
- asp.net 发布到IIS中出现”处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”“错误的解决方法
- ORA-00257: archiver error. Connect internal only, until freed 错误的处理方法
- 在Windows上调整SGA大小遭遇ora-27100、ora-27102错误的处理方法
- PHP实现抓取HTTPS内容的方法和错误处理
- SVN各种错误提示产生原因及处理方法大全
- 8080端口被占用 Tomcat启动错误 处理方法(关闭windows端口通用方法)
- libxml/HTMLparser.h file not found 解决方法 (libxml.dylib错误处理)
- C语言错误处理方法、C++异常处理方法(throw, try, catch)简介
- Error loading opeating system 加载系统错误处理方法
- 用友U8对账不平,对账错误简单处理方法
- 错误类型:Provider (0x80004005)未指定的错误 的一个处理方法
- ORA-00257: archiver error. Connect internal only, until freed 错误的处理方法
- java中三种常见内存溢出错误的处理方法