0

How to know when any application is opened or closed in Windows 8 or 10 using C#?

Is there any specific event we can subscribe?

iamnicoj
  • 487
  • 7
  • 13
  • I'm not saying there isn't one, but I've not heard of an event for this. You could instead regularly get a list of all running processes and compare the new list to the values from last time. The difference between the two would let you know what has opened and closed. – Equalsk Jan 13 '16 at 15:55
  • 2
    @i486 I think you know what the OP means when they state `using C#` come on now.. – MethodMan Jan 13 '16 at 15:55
  • The linked answer doesn't show exactly how to monitor applications closing, but you just use the `__InstanceDeletionEvent` in exactly the same way as the linked answer uses `__InstanceCreationEvent`. – Matthew Watson Jan 13 '16 at 15:56
  • Not sure if this is an *exact* duplicate, but this may be helpful: http://stackoverflow.com/questions/1986249/net-process-monitor – David Jan 13 '16 at 15:56
  • @LaPuyaLoca you can use the `Process` class you could even look into `Mutex` but that's a bit more advanced also check this previous post out this will do the trick for you [Checking if Windows application is running](http://stackoverflow.com/questions/4722198/checking-if-a-windows-application-is-running) – MethodMan Jan 13 '16 at 15:57
  • @i486 C# is the Microsoft programming language used in VisualStudio – iamnicoj Jan 13 '16 at 16:02

0 Answers0