I'm asking a question which my mind goes b开发者_JS百科lank 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!
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.
精彩评论