I have a situation where I have to detect when an application window is closed. I am currently just looking in the task manager to see if the app is running or not.
But now when the app window is closed I need to determine if this was an event caused by the user or another process.
So how can I hook into a window’s event within a vbscript?
You can monitor when a program stops in VBScript using WMI. That’s pretty simple. You can even set up an event-driven script that executes when it stops. It looks like this:
The problem is that there is no way to detect why it stopped or what action caused it unless that specific program fires an event or writes to the event log (or any other log for that matter). Sorry.