[DllImport("advapi32.dll", EntryPoint="InitiateSystemShutdown")]
public static extern int InitiateSystemShutdownA(string lpMachineName,
string lpMessage, int dwTimeout, int bForceAppsClosed, int
bRebootAfterShutdown);
public void RestartPC(object sender, System.EventArgs e)
{
int restartcode=InitiateSystemShutdownA("\\127.0.0.1", "Restart...", 10,
1, 1);
MessageBox.Show("OK"+restartcode);
}
Am i right?
but the parameter restartcode is 0,and my computer still run.
"W.G. Ryan eMVP" <Wi*********@NoSpam.gmail.com> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
You cna use the API
http://custom.programming-in.net/art...SystemShutdown
Or you can freestyle and just loop through each active process on your
computer and shut it down -
--
W.G. Ryan MVP (Windows Embedded)
TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
<lz**@0536.net> wrote in message
news:uy**************@TK2MSFTNGP11.phx.gbl... I want use C# to restart my computer,
how to?