Thanks Jason that worked just fine.
: I have a complete .NET control at my website under the Visual
: Basic.NET - Controls page that will restart, shutdown, logoff,
: initiate shutdown, and more that is very easy to use. Simply add a
: reference to the compiled class library and create a instance and
: your good to go.
:
: You could also use shell code to manipulate the Windows Shutdown
: Process to shutdown the computer. Example:
:
: Process.Start("shutdown -s -f -t 0") 'Will Shutdown the computer.
:
: Process.Start("shutdown -r -f -t 0") 'Will Reboot the computer.
:
: Process.Start("shutdown -l -f -t 0") 'Will Logoff the user.
:
:
: Hope this helps :)
:
:
: Jason
:
:
:
: : Windows XP
: : I am trying to shut down the computer after saving files and have
: : tried to use this code which was supplied on another thread. The
: : code works fine for loging off but I can't get it to shut down the
: : computer. Am I missing something?
: :
: :
: : Module Module1
: : Declare Function ExitWindowsEx Lib "user32" Alias
: : "ExitWindowsEx" (ByVal uFlags As _
: : Integer, ByVal dwReserved As Integer) As Integer
: :
: : Public Enum Choices
: : Logoff = 0
: : Shutdown = 1
: : Reboot = 2
: : ForceLogOff = 4
: : ForceReboot = 6
: : PowerDown = 8
: : ForcePowerDown = 12
: : End Enum
: :
: : Public Sub ExitFromWindows(ByVal Choice As Choices)
: : ExitWindowsEx(Choice, 0)
: : End Sub
: :
: : End Module
: :
: : Thanks Malcolm Mack
:
: --------------------------------------------
:
: Visual Basic Code Source (New Design!) -
http://www.vbcodesource.org
:
: Visual Basic Code Source -
http://www.vbcodesource.com