Shutdown Manager in C#
Submitted by donbermoy on Wednesday, June 18, 2014 - 09:58.
In this tutorial, we will create a shutdown manager program that can log off, restart, and turn off your computer.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application in C# for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add three buttons named Button1 labeled as "Shutdown", Button2 labeled as "Logoff", and Button3 labeled as "Restart". You must design your interface like this:
3. Put this code below in Button1 for shutdown button. This will shutdown your pc after 10 seconds.
4. Put this code below in Button2 for Log Off button. This will log off your pc after 10 seconds.
5. Put this code below in Button3 for Restart button. This will log off your pc after 10 seconds.
Legends:
s stands for shutdown
r stands for restart
l stands for log off
t stands for countdown time
a stands for abort/cancel
c stands for message box and word is seperate by comma
The shell method here represents the objects in the Shell. Methods are provided to control the Shell and to execute commands within the Shell.
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
If you have some queries, feel free to contact the number or e-mail below.
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

- public void Button1_Click(System.Object sender, System.EventArgs e)
- {
- Interaction.Shell("shutdown -s -t 10 -c computer,will,shutdown,after,10,seconds", (Microsoft.VisualBasic.AppWinStyle) 2, false, -1);
- }
- public void Button2_Click(System.Object sender, System.EventArgs e)
- {
- Interaction.Shell("shutdown -l -t 10 -c computer,will,log-off,after,10,seconds", (Microsoft.VisualBasic.AppWinStyle) 2, false, -1);
- }
- public void Button3_Click(System.Object sender, System.EventArgs e)
- {
- Interaction.Shell("shutdown -r -t 10 -c computer,will,restart,after,10,seconds", (Microsoft.VisualBasic.AppWinStyle) 2, false, -1);
- }
Add new comment
- 202 views