从程序开始和结束进程 [英] Starting and Ending Processes from a program

查看:86
本文介绍了从程序开始和结束进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.

我创建了一个程序P1,它将由Windows

服务触发。应该在Sub OnStop中添加什么命令来强制

进程P1在服务停止时结束?

2.

我是使用Shell方法从程序P3启动程序P2。什么

方法可以用来结束程序P2?

非常感谢,

Dan

解决方案

>我创建了一个程序P1,它将由Windows

服务触发。应该在Sub OnStop中添加什么命令以强制
进程P1在服务停止时结束?




我认为这可能取决于关于你是否希望申请结束

优雅与否。是你的应用程序正在运行?这是一个

..NET申请?如果是这样,那么您可能希望进入远程处理以启用

您可以向关闭的应用程序发送命令。如果没有,那么它就是一个完全不同的球赛,它需要终止这个过程,但是如果它当时忙着做一些重要的事情呢?看看

如下所示,看起来它可以帮助你...

http://www.buygold.net/v06n04/v06n04.html


尼克。


-

/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \\ \\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \\ \\

无论如何。无论结果如何,你都会被改变。


Fergus - 2003年9月5日

/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \\ \\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \


非常感谢Nick。我会试一试。

祝你好运,

Dan

" Nak" < a@a.com>在消息中写道

news:er ************** @ TK2MSFTNGP10.phx.gbl ...

我创建了一个程序P1,它将由Windows
服务触发。应该在Sub OnStop中添加什么命令来强制
进程P1在服务停止时结束?
我认为这可能取决于你是否希望应用程序结束
优雅与否。是你的应用程序正在运行?它是一个.NET应用程序吗?如果是这样,那么你可能想进入远程处理



使你能够向关闭的应用程序发送命令。如果不是那么它是
一个完全不同的球类游戏,它需要终止这个过程,
但是如果它正忙于做一些重要的事情呢?看看下面的内容,看起来它可以帮助你...

http://www.buygold.net/v06n04/v06n04.html

尼克。

- -

/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \\ \\ / \\ \\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \\ \\ \\无论如何。无论结果如何,你都会被改变。

Fergus - 2003年9月5日

/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \



嗨Dan,


另一种方式是老式的Windows消息。


您可以发送WM_CLOSE,也可以发送您自己制作的用户消息(如果P1和P2属于您且可编辑)。


问候,

弗格斯


1.
I have created a program P1 which is going to be triggered by a Windows
Service. What command should be added in the Sub OnStop to force the
process P1 to end when the service is stopped?
2.
I am using the method Shell to start a program P2 from a program P3. What
method can be used to end the program P2?
Many thanks,
Dan

解决方案

> I have created a program P1 which is going to be triggered by a Windows

Service. What command should be added in the Sub OnStop to force the
process P1 to end when the service is stopped?



I''m think that might depend on whether you want the application to end
gracefully or not. Is it your application that is being run? and is it a
..NET application? If so then you might want to get into remoting to enable
you to send a command to the application the shut down. If not then it is a
completely different ball game, it would require terminating the process,
but what if it is busy doing something important at the time? Take a look
at the following like, it looks like it could help you...

http://www.buygold.net/v06n04/v06n04.html

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


Thank you very much Nick. I''ll give it a try.
Best regards,
Dan
"Nak" <a@a.com> wrote in message
news:er**************@TK2MSFTNGP10.phx.gbl...

I have created a program P1 which is going to be triggered by a Windows
Service. What command should be added in the Sub OnStop to force the
process P1 to end when the service is stopped?
I''m think that might depend on whether you want the application to end
gracefully or not. Is it your application that is being run? and is it a
.NET application? If so then you might want to get into remoting to


enable you to send a command to the application the shut down. If not then it is a completely different ball game, it would require terminating the process,
but what if it is busy doing something important at the time? Take a look
at the following like, it looks like it could help you...

http://www.buygold.net/v06n04/v06n04.html

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ "No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\



Hi Dan,

Another way is good old-fashioned Windows messages.

You can either send a WM_CLOSE, or a user-message of your own making (if P1 and P2 are yours and editable).

Regards,
Fergus


这篇关于从程序开始和结束进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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