Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

See if this[^] can help.
 
Share this answer
 
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 of JobObjectBasicLimitInformation and pass a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure[^] with the LimitFlags containing the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE bits set. You can prevent additional processes from being created by setting the JOB_OBJECT_LIMIT_ACTIVE_PROCESS bits and populating the JOBOBJECT_BASIC_LIMIT_INFORMATION.ActiveProcessLimit member

Best Wishes,
-David Delaune
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900