如何关闭错误信息窗口?(100分)

  • 主题发起人 主题发起人 hello2
  • 开始时间 开始时间
H

hello2

Unregistered / Unconfirmed
GUEST, unregistred user!
向各位大侠请教:<br>&nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; 我的程序在运行过程中出现了差错,windows给出了消息窗口,请问如何<br>&nbsp; 关闭消息窗口,然后让应用程序继续运行。十万火急。<br>&nbsp; &nbsp; &nbsp; 另外,请问如何关闭正在运行的DOS程序。<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 感谢内热心给予帮助。<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hello1
 
1.try<br>&nbsp; 你的程序<br>except<br>&nbsp; <br>end;<br>2.sendmessage行不行?(windows下可以,dos下没试过)
 
1. chenke的方法可以避免错误,但是不是关闭窗口:)不过我同意用这个方法:)<br>2. 用WIN程序不能关DOS程序:(除非使用强硬手段:))
 
使用 except 的好处就是在程序出错是能够通过 OnExcept 进行处理并保证程序能过<br>继续运行:<br><br>try<br>&nbsp; ...<br>except<br>&nbsp; On 已知Exception<br>&nbsp; &nbsp; &nbsp;进行处理<br>&nbsp; On Exctpt<br>&nbsp; &nbsp; &nbsp;忽略错误不出现错误消息<br>end;
 
Application.OnException = YourExceptionHanlder
 
lhz的方法最地道.
 
hello2的第一个问题被解决掉了,第二个问题还请大虾们各抒己见
 
To stop a DOS process, you can use TerminateProcess function to do so.
 
多人接受答案了。
 
后退
顶部