Re: how to do this in vb?
Try this
Code:
Option Explicit
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Sub Command1_Click()
Dim a As Integer
a = MsgBox("Are you sure you want to logoff?", vbQuestion + vbYesNo + vbDefaultButton2)
If a = vbOK Then
ExitWindowsEx EWX_FORCE Or EWX_LOGOFF, 0
End If
End Sub
Re: how to do this in vb?
Try:
Code:
Shell("cmd /c C:\YourFolder\YourFile.bat", AppWinStyle.NormalFocus)
Re: how to do this in vb?
Here's another way without using a batch file:
Code:
Shell "CMD /C @ECHO OFF & LOGOFF", vbHide
The switch /C tells cmd.exe to execute the succeeding arguments. The ampersand (&) concatenates multiple commands on one line.