我在程序中调用shellexecute()运行了一个外部程序snort.exe,该程序运行在dos窗口中,现要在我的程序中中止该snort.exe的运行,我试图用sendmessage()来关闭该窗口,但是弹出一条信息提示说windows无法关闭该窗口,是否强行关闭,当然我选择“是”可以关闭该窗口,但是我想知道有没有别的方法可以一步到位,直接关闭该窗口,恳请帮忙。
解决方案 »
- 真假?Delphi for iPhone 1.0 released!
- 设计期控制edit的text
- 请教高手们,加载窗体时使用多线程显示进度的问题!
- 有关文本文件和二进制文件的问题,大家进来看看
- 300求,基于同一个父类的override,有设计模式可用吗?
- 日期型的问题,大家看一下代码怎改
- 求一函数,能去掉字符串的空格,情况较复杂。up有分
- 想请问一个关于TBolbField的问题? (急).
- 怎样才能在一个列表框中列出所有的midi输入或输出设备?
- 关于网络文件传输
- 请问,可否用DELPHI打开一个没有工具栏和菜单栏的IE浏览器?怎样实现?
- 请问 一个 indy Smtp 发邮件问题。 主题长度太长时, 出现收到的邮件不正常,如何解决呢?
那你就可以用TerminateProcess 强制结束进程的方式来结束应用程序呀:The TerminateProcess function terminates the specified process and all of its threads. BOOL TerminateProcess( HANDLE hProcess, // handle to the process
UINT uExitCode // exit code for the process
);
ParametershProcessIdentifies the process to terminate.
Windows NT: The handle must have PROCESS_TERMINATE access. For more information, see Process Objects. uExitCodeSpecifies the exit code for the process and for all threads terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process's exit value. Use the GetExitCodeThread function to retrieve a thread's exit value.
SendMessage(handle,WM_CLOSE,0,0);