There can be no Triumph without Loss,No Victory without Suffering,No Freedom without Sacrifice.
All you have to decide is what to do with the time that is given to you.
Get busy Living, or Get busy Dying?
  首页 | 留言给我 | 订阅 Rss | CLI | 黄白之恋 Posts:158   Hits: 5010557    Comments: 173    
 日历归档
<<  <  2024 - 03  >  >>
SuMoTuWeThFrSa
     12
3456789
10111213141516
17181920212223
24252627282930
31
 About Me
 Name: ZhangSichu
 Sex: Male
 Age: 32
 Email: ZhangSichu@gmail.com
 MSN: ZhangSichu@hotmail.com
 Home: ZhangSichu.com
 WeiBo: weibo.com/zhangsichu
 个人推荐
 分类归档
  ·C++/C(5)  RSS
  ·软件工程(1)  RSS
  ·杂事/随感(26)  RSS
  ·.Net/Java(30)  RSS
  ·面向对象程序设计(5)  RSS
  ·汇编/破解(0)  RSS
  ·平面设计(3)  RSS
  ·SQL(5)  RSS
  ·COM/COM+(2)  RSS
  ·Web开发(81)  RSS
 My Friends
Back Forward Refresh Home 2024年3月28日 星期四 RSS CLI Mine Sweeper. In Javascript.

  好用的Application.ThreadException
字体大小 [ ]

好用的Application.ThreadException
在编写Windows程序中,在VS2005下都会用下面的代码来启动主Form.
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
这段代码一般由IDE自动生成。
Application.Run启动一个线程,这里把一个MainForm放在这个线程中,并把这个线程放入Application Main这个进程中,并完成消息循环。
如何当这个线程出Exception时,Handle上这个线程中的Exception。
用 Application.ThreadException += 自己的处理方法。

这个方法十分简单的为客户代码提供了一个处理 MainForm线程中所有Exception的接口。
用十分方便的手段Handle了Application中的ThreadException。
  Posted @ 12/25/2006 4:56:53 PM | Hits (38203) | Comments (1

  Comment
 #re:好用的Application.ThreadException  1/10/2008 11:24:54 AM  qinghua
==
  Post Comment
标题 *
作者 *
密码 记住我
评论 *
    


Stable in Firefox 1.5 2.0Stable in IE6 IE7Stable in MozillaStable in Netscape
ZhangSichu.com V0.1.7507
Powered By ZhangSichu
Copyright © ZhangSichu
Download ZhangSichu.com source code. Download source code