Shutdown, Restart & Relogon from Vb4 
Author Message
 Shutdown, Restart & Relogon from Vb4

        Can someone please tell me how I would Restart, shutdown or relogon from a
menu. Thank You



Sun, 21 Nov 1999 03:00:00 GMT  
 Shutdown, Restart & Relogon from Vb4


GMT):

Quote:
>    Can someone please tell me how I would Restart, shutdown or relogon from a
>menu. Thank You

See FAQ, link below.

Mathias Schiffer, Germany
-----------------------------------------------
VB-FAQ: http://home.sol.no/jansh/vb/default.htm
NG-tips: http://www.rat.de/metty/vbnews



Mon, 22 Nov 1999 03:00:00 GMT  
 Shutdown, Restart & Relogon from Vb4

'General.bas
Declare Function GetVersionEx& Lib "kernel32.dll" Alias "GetVersionExA"
(lpStruct As OsVersionInfo)
Declare Function AbortSystemShutdown& Lib "advapi32.dll" Alias
"AbortSystemShutdownA" (ByVal lpMachineName$)
Declare Function ExitWindowsEx& Lib "user32" (ByVal uFlags&, ByVal
dwReserved&)
Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long,
ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Any) As
Long

Type OsVersionInfo
     dwVersionInfoSize As Long
     dwMajorVersion As Long
     dwMinorVersion As Long
     dwBuildNumber As Long
     dwPlatform As Long
     szCSDVersion As String * 128
End Type

Private OsVer As OsVersionInfo
Global Const VER_PLATFORM_WIN32_WINDOWS = 1
Global Const VER_PLATFORM_WIN32_NT = 2
Global Const EWX_FORCE = 4 'constants needed for exiting Windows
Global Const EWX_LOGOFF = 0
Global Const EWX_REBOOT = 2
Global Const EWX_SHUTDOWN = 1

Global Const HELP_QUIT = 2
Global Const HELP_INDEX = 3
Global Const HELP_HELPONHELP = 4
Global Const HELP_PARTIALKEY = &H105

sub command1_click()
 lresult = ExitWindowsEx(EWX_SHUTDOWN, 0&) 'shut down the computer
end sub

sub command2_click()
lresult = ExitWindowsEx(EWX_REBOOT, 0&) 'restart the computer
end sub

sub command3_click()
 lresult = FileExists(WinPath + "\Exit to dos.pif") 'make sure the pif file
exists
   If lresult = False Then 'the file could not be found
      MsgBox "Cannot find " + WinPath + "\Exit To Dos.pif" + Chr(10) +
Chr(10) + "Please make sure this file is in your Windows directory",
vbCritical 'display an error message
   Else                                                'otherwise
      lresult = Shell(WinPath + "\Exit To Dos.pif", 1) 'execute the pif
file
   End If
end sub

sub command
4_click()
 lresult = ExitWindowsEx(EWX_LOGOFF, 0&) 'close all programs and log on as
a different user
end sub



Quote:
> Can someone please tell me how I would Restart, shutdown or relogon from
a
>menu. Thank You



Mon, 22 Nov 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Shutdown, Restart & Relogon from Vb4

2. Question about shutdown,reboot,relogon

3. shutdown/restart windows

4. Can anybody send VB.net Code to shutdown or restart local computer for me

5. logoff, restart, shutdown

6. ShutDown, Logoff, Restart ? How

7. windows95 shutdown/wait/restart?

8. Windows Shutdown, restart, logoff...?

9. Help Windows-Shutdown-Restart

10. Help Windows-Shutdown-Restart

11. Restart/Shutdown Script

12. Shutdown and restart windows

 

 
Powered by phpBB® Forum Software