检查父进程是否还活着? -从浏览器启动应用程序,关闭浏览器后将其杀死. [英] Check if parent process is alive ? - An app is launched from browser, Kill it when browser is closed .
本文介绍了检查父进程是否还活着? -从浏览器启动应用程序,关闭浏览器后将其杀死.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从执行特定任务的浏览器中启动应用程序.在firefox应用程序中,是通过用javascript编写的firefox插件启动的.在IE BHO中执行此任务.
当浏览器关闭时,我需要杀死我的应用程序.
Hi,
I am launching an application from a browser which performs a particular task. In firefox app is launched through firefox plugin written in javascript. In IE BHO does this task.
I need to kill my application when browser is closed
推荐答案
看看是否 ^ ]可以提供帮助.
See if this[^] can help.
由于您是通过Web浏览器帮助程序对象执行此操作的,因此应考虑使用作业对象执行此操作.它允许您对子进程设置安全限制,否则子进程将不可用.
最好的方法是使用 CreateJobObject函数 [ ^ ],然后在浏览器中创建作业对象.然后,您可以调用 AssignProcessToJobObject函数 [ ^ ],然后将子进程分配给作业.若要在父进程终止时关闭子进程...,您可以调用 ^ ]的JobObjectInfoClass为JobObjectBasicLimitInformation
,并传递 ^ ],其中LimitFlags包含设置的JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
位.您可以通过设置JOB_OBJECT_LIMIT_ACTIVE_PROCESS
位并填充JOBOBJECT_BASIC_LIMIT_INFORMATION.ActiveProcessLimit
成员来防止创建其他进程
最好的祝福,
-大卫·德劳恩(David Delaune)
Hi,
Since you are doing this from a web browser helper object you should consider doing this with a job object. It allows you to put security restrictions on the child process that would otherwise not be available.
The best way to do this is to use the CreateJobObject function[^] and create a job object within the browser. Then you could call the AssignProcessToJobObject function[^] and assign the child process to the job. To have the child process close when the parent terminates... you would call the SetInformationJobObject function[^] with the JobObjectInfoClass ofJobObjectBasicLimitInformation
and pass a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure[^] with the LimitFlags containing theJOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
bits set. You can prevent additional processes from being created by setting theJOB_OBJECT_LIMIT_ACTIVE_PROCESS
bits and populating theJOBOBJECT_BASIC_LIMIT_INFORMATION.ActiveProcessLimit
member
Best Wishes,
-David Delaune
这篇关于检查父进程是否还活着? -从浏览器启动应用程序,关闭浏览器后将其杀死.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文