Im sort of a beginner with no real training in VB, but I know enough to do a few cool stuff, I wonder if there is a code used to SHUTDOWN Win98 with VB 3.0?
Printable View
Im sort of a beginner with no real training in VB, but I know enough to do a few cool stuff, I wonder if there is a code used to SHUTDOWN Win98 with VB 3.0?
VB Code:
#If Win32 Then Private Declare Function Shutdown Lib "user32" Alias _ "ExitWindowsEx" (ByVal uFlags As Long, ByVal _ dwReserved As Long) As Long Private Const EWX_LOGOFF = 0 Private Const EWX_SHUTDOWN = 1 Private Const EWX_REBOOT = 2 Private Const EWX_FORCE = 4 #Else Private Declare Function Shutdown Lib "User" Alias _ "ExitWindows" (ByVal dwReturnCode As Long, ByVal _ wReserved As Integer) As Integer Private Const EW_REBOOTSYSTEM = &H43 Private Const EW_RESTARTWINDOWS = &H42 #End If Private Sub cmdOk_Click() Dim exit_option As Long exit_option = CLng(optExitOption(SelectedOption).Tag) Shutdown EWX_SHUTDOWN 'this will Shut your computer down 'If you want to restart use one of the other Consts! End Sub
Thanx.:wave:
no problem! ;)
I have a problem, the code worked once but after I tried to do it again VB didnt recognise it so now Im stumped!!:eek2:
mmm...
well, try just making it as simple as you can:
VB Code:
Private Declare Function Shutdown Lib "user32" Alias _ "ExitWindowsEx" (ByVal uFlags As Long, ByVal _ dwReserved As Long) As Long Private Const EWX_LOGOFF = 0 Private Const EWX_SHUTDOWN = 1 Private Const EWX_REBOOT = 2 Private Const EWX_FORCE = 4 Private Sub Form_Load() msg = MsgBox "Ary you shure you want to shutdown windows?", vbYesNo, "Shutdown?" If msg = vbYes Then Shutdown EWX_SHUTDOWN
Thanx that worked! :wave: