How to Shutdown PC on Some given Time

viking_p

Member
Joined
Mar 11, 2005
Messages
5
Location
India
Programming Experience
3-5
Hi,

i want to code this program where i want my PC to shutdown or restart on a given time, is it possible, for e.g i want my PC to restart / shutdown after 5 hours how can i do it.

thanks in advance
Regards
Viking
 
My example below uses the Win32 API call, ExitWindowsEX, to Shutdown, restart, logoff, and force shutdown any windows PC. I did not add any comments, but if there is something that you do not understands then let me know.
 

Attachments

  • System Shutdown.zip
    10.7 KB · Views: 132
Last edited:
Also here's a link to a site with a project that shuts down windows after a given time. This doesn't use the win32 API so may not work on earlier versions of windows.

http://www.codeproject.com/useritems/shutdownwin.asp

It's coded at the moment to just shutdown windows. But if you change this line...

VB.NET:
 System.Diagnostics.Process.Start("Shutdown", "/s")

To this...

VB.NET:
System.Diagnostics.Process.Start("Shutdown", "/r")

It will restart windows.
 
Back
Top