Hi, I am having the need to have a program that will auto shutdown when the computer is done downloading and or installing a program. So I decided to try to make my own in visual C#.
MY Plan: Well the idea is simple, In my application I want the user to be able to write down all the process's names for each of the programs that is being installed or downloaded using a richtextbox. that way the application can keep track of only the selected processes. Then when the processes from the list are done it will trigger an event that will shutdown the computer.
Example: lets say I have Microsoft word installing itself. The process that it is called is msword.exe(for example). The user will type in a richtextbox the name of that process in the application to track it. after it is done installing the Microsoft word program will exit causing the process to end. When my application acknowledges that the process is done then it will fire the shutdown computer trigger.
Question: So the problem that I am having is pretty much everything except turning the computer off :) I need some help, I don't know how to add the process's to my application so it can track it when you write it down in the richtextbox.
Thank You: I will appreciate any help coming from anyone who posts here.
12/20/2011 - 10:43
1. Use GetProcessByName to get a Process object for the each name the user entered in the textbox.
2. For each Process object, set EnableRaisingEvents to true.
3. Hook the Exited event on each Process object. When all of them have exited, shutdown the computer.
Add Comment
[language] [/language]
Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]
See here for supported languages.
Javascript must be enabled to submit anonymous comments - or you can login.