'Open New Project which contains one form, 4 buttons and one module.Name button 1 as Logoff, button 2 as Reboot, button 3
'as ShutDown and the last one as Quit. Declare api public function in module together with all constants needed.in module
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Public Const EWX_FORCE = 4
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_LOGOFF = 0

'And place this code in the form
Private Sub Command1_Click()
'Force windows to log out from the current user
Dim y As Long
y = ExitWindowsEx(EWX_FORCE Or EWX_LOGOFF, 0)
End Sub

Private Sub Command2_Click()
'Force windows to close all aplication and reboot theComputer
Dim y As Long
y = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)
End Sub

Private Sub Command3_Click()
'Force Windows to Close all application and shutdown the Computer.
Dim y As Long
y = ExitWindowsEx(EWX_FORCE Or EWX_SHUTDOWN, 0)
End Sub

Private Sub Command4_Click()
Unload Me
End Sub