software monitor

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
I know how to monitor newly created files etc but what i want to do now is monitor firefox and IE when they close.

my application is running in the bg and i need it to perform a command when the browser closes.

can any one point me in the right direction?
 
You could try to find the process by it's name and then capture the Exited-Event.

Something like:
VB.NET:
                                Dim webProc() As Process = Process.GetProcessesByName("firefox")
                                For Each proc As Process In webProc
                                    AddHandler proc.Exited, webProcExited
                                Next

' ...

    Public Sub Exited(ByVal sender As Object, ByVal e As System.EventArgs)
        'your code
    End Sub

Bobby
 
That should be
VB.NET:
AddHandler proc.Exited, [B][COLOR="Green"]AddressOf [/COLOR][/B]Procs_Exited
According to help for Exited event you also need to set this first:
VB.NET:
proc.EnableRaisingEvents = True
 
Works treat, thank you both. Just curious, what would you change to add more then one process to mo9nitor?
 
Back
Top