Seif Shawkat
Seif Shawkat

Reputation: 237

Vb.net process close event

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

Answers (1)

Reed Copsey
Reed Copsey

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

Related Questions