Reputation: 237
I'm asking a question which my mind goes blank on how it'll be coded... I'm trying to make a simple program that detects if a game closes, and when it does, it shuts down the computer.
Thanks!
Upvotes: 0
Views: 800
Reputation: 564831
Once you have the process, you can set EnableRaisingEvents to true, and the process will raise the Exited event.
As for shutting down the system - this is potentially more difficult. You can P/Invoke ExitWindowsEx, but it requires specific permissions (SE_SHUTDOWN_NAME
) or it will fail.
Upvotes: 2