Click here to Skip to main content
11,410,118 members (60,816 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ Windows

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 27-Mar-12 1:43am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

See if this[^] can help.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


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

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 169
1 OriginalGriff 110
2 Maciej Los 68
3 BillWoodruff 60
4 Philippe Mori 60
0 Sergey Alexandrovich Kryukov 8,755
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059

Advertise | Privacy | Mobile
Web04 | 2.8.150414.5 | Last Updated 27 Mar 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100