how to shutdown and restart my pc

Posted by Nadh123 under C# on 12/21/2012 | Points: 10 | Views : 818 | Status : [Member] | Replies : 1
how to shutdown and restart my pc based on login user name

Mahendra
91-9908699686



Responses

Posted by: Naraayanan on: 12/21/2012 [Member] Starter | Points: 25

Up
0
Down
Hi
Try This Code:

using System.Runtime.InteropServices;

public static extern int ExitEx(int operationFlag, int operationReason);
[DllImport("user32.dll")]

for ShutDown
ExitEx(1, 0);

For Restart:
ExitEx(2, 0);



Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Nadh123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response