Results 1 to 6 of 6

Thread: [2005] restart computer

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    [2005] restart computer

    how do i restart computer programatically in .NET 2.0 / VS 2005
    Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water

    Huzefa Yousuf
    Software Engineer
    Verticity Inc.
    +92-345-2235303

    [email protected]

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] restart computer

    Multiple examples already posted on the forum. Execute shutdown.exe from the system32 folder with the appropriate commandline arguments or use the ExitWindowsEx API.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: [2005] restart computer

    i have already used the Shutdown.exe code
    System.Diagnostics.Process.Start("Shutdown", "/r")
    but it takes 30 seconds before proceeding, i want it to be direct
    can u pls give me the example of the ExitWindow API that u were referring to
    Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water

    Huzefa Yousuf
    Software Engineer
    Verticity Inc.
    +92-345-2235303

    [email protected]

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] restart computer

    Shutdown.exe will NOT take 30 seconds if you pass it the correct commandline parameters. Read the Windows help topic for it and that explains all the commandline parameters, or else do the standard for Windows commandline apps that require commandline parameters and use the command prompt itself to get help. If you enter "shutdown" into a command prompt with no commandline parameters or with the "/?" switch it will tell you what all the accepted commandline parameters are.

    As for ExitWindowsEx, as I said, there are already multiple examples posted on the forum so I'm not going to add another.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [2005] restart computer

    You can also simply crash it using some handy critical service. It'd take less than a second so you have a choice between a speedy restart or a safe recovery.
    VB 2005, Win Xp Pro sp2

  6. #6
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301

    Re: [2005] restart computer

    you can use System.Diagnostics.Process.Start("Shutdown", "/r /t 00") which will set the timer to 00 and instant restart.

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width