Click here to Skip to main content
11,578,524 members (61,614 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 0: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 Peter Leow 175
1 Richard MacCutchan 165
2 OriginalGriff 129
3 Afzaal Ahmad Zeeshan 90
4 Frankie-C 75
0 OriginalGriff 904
1 Sergey Alexandrovich Kryukov 715
2 Abhinav S 573
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 393

Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | 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