I was downloading a game(which took forever) and I had the need to leave the house before it was done. That gave me a new idea on what project I should do next. I want to create an application in visual C# that will shutdown the computer when everything from downloads to installing a program is complete. I know how to shutdown the computer using code but to make it shutdown after the events are complete is what is troubling me. I would appreciate the help.

PS: my operating system is windows vista. Also if there is a way to achieve this in batch or VBScript I would like to know how as well.

Thanks,

link|improve this question

feedback

closed as off topic by haimg, techie007, surfasb, grawity, ChrisF Dec 13 '11 at 23:39

Questions on Super User are expected to generally relate to computer software or computer hardware, within the scope defined in the faq.

2 Answers

up vote 0 down vote accepted

The course of action IMO, is to use the WMI classes to enumerate the running processes. Depending on the game and the installer, just look for the running process and when it no longer shows up, shutdown the computer.

The Tabs Manager tab would be unreliable since the application may completely change the name of window. Setup programs for games may also decide to spawn a separate installer for different components, like directx.

link|improve this answer
I guess I'll have to try something else, in the mean time thanks all of you for your help. – mendez Dec 13 '11 at 22:22
feedback

I don't think it's possible. You would need to have those applications send messages to your apllication. Also, when your PC is doing nothing, Windows starts indexing and other stuff.

link|improve this answer
hmm, what do you mean indexing? like filing? if so then is it possible to somehow work with the task manager? for example if the task manager in the applications tab is empty then that could trigger the event. – mendez Dec 13 '11 at 19:59
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.