Results 1 to 6 of 6

Thread: [RESOLVED] Shutdown code

Hybrid View

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

    Re: Shutdown code

    You can call Process.Start to execute the command PENNYSTOCK suggests, but it must be done with two parameters:
    VB Code:
    1. Process.Start("shutdown", "-s -t 00")
    The shutdown.exe commandline program can do much more than that too. You can get help on its parameters either in the Windows help or on the commandline itself. The other option is to use the ExitWindowsEx API. There are plenty of examples on the forum already. Keep in mind that while both these options will work on WinXP they are not available on all Windows versions. I believe that there's another API too but I can't remember the name. Something like "InitiateWindowsShutdown" but not quite.
    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

  2. #2
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    413

    Re: Shutdown code

    There is this too...An API. However, this just shows the shut down dialog screen.

    Declare Function SHShutDownDialog Lib "shell32" Alias "#60" (ByVal YourGuess As Int32) As Int32

    Then just call

    VB Code:
    1. SHShutDownDialog(1234)

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