Friday, April 19, 2013

How To Shut Down Your Computer In C#

4:47 PM



Shutdown computer in C#




using System.Diagnostics;
///////////////////////////////////////////
String shutdown;

/////////// Start Button //////////////////
Process.Start("Shutdown", shutdown + " -t " + textBox1.Text + @" -c ""Windows is going to shut down!""");
// -t = time , -c = comments
timer1.Start();
label3.Text = textBox1.Text;

/////////// Abort Button //////////////////
Process.Start("Shutdown", "-a"); timer1.Stop(); // -a = abort

/// ComboBox_SelectedIndexChanged Event ///
switch (comboBox1.SelectedIndex)
{
case 0: shutdown = "-s"; break; // -s = shutdown
case 1: shutdown = "-r"; break; // -r = restart
case 2: shutdown = "-l"; break; // -l = log off
}

/////////// Timer_Tick Event //////////////
label3.Text = (Convert.ToInt32(label3.Text) - 1).ToString();



-----------------------------------------
.net - How to shutdown the computer from C#
Shut Down, Restart, Log off or Lock your computer in C#
How To Shut Down Your Computer In C#
Shutdown computer in C#
shut down,restatrt remote computer‎
How do I programmatically shutdown the computer?
Remote Shutdown

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top