如何在 VB6 中关闭一个带壳的进程 [英] How to close a shelled process in VB6

查看:69
本文介绍了如何在 VB6 中关闭一个带壳的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的 VB6 应用程序中取出一个应用程序.然后我想关闭它.我怎样才能做到这一点?

I shell out an application from my VB6 app. I would then like to close it. How can I pull this off?

推荐答案

这里是 KarlPeterson 用于关闭应用程序的 VB6 方法.根据您的要求,这很好 - 发送 WM_CLOSE 而不是使用 TerminateProcess.请注意,它将消息发送到属于该进程的所有顶级窗口,可能不止一个.

Here is Karl Peterson's VB6 method for closing applications. As you request, this asks nicely - sending WM_CLOSE rather than using TerminateProcess. Note that it sends the message to all of the top-level windows belonging to the process, there could be more than one.

我还没有尝试过,但根据我的经验,Karl Peterson 的代码总是给五颗星中的五颗星打分!

I haven't tried this, but in my experience Karl Peterson's code always rates five stars out of a possible five!

请注意,这是原始答案的编辑版本,现在链接到最新版本的 Karl 代码.如果有人对此有疑问,Karl 仍然活跃在 VB6新闻组,但我认为他不会在 Stack Overflow 上闲逛.

Please note this is an edited version of the original answer, and now links to the latest version of Karl's code. If anyone has questions about this, Karl is still active on the VB6 newsgroup but I don't think he hangs out on Stack Overflow.

这篇关于如何在 VB6 中关闭一个带壳的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆