|
-
Dec 26th, 2004, 05:06 PM
#1
Thread Starter
Member
How to shut down Win98 with VB 3.0?
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?
Last edited by MendyGreen; Dec 27th, 2004 at 05:46 PM.
-
Dec 26th, 2004, 09:50 PM
#2
Fanatic Member
Re: How to shut down 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
-
Dec 26th, 2004, 11:57 PM
#3
Thread Starter
Member
Re: How to shut down Win98 with VB 3.0?
Thanx.
-
Dec 27th, 2004, 03:10 AM
#4
Fanatic Member
Re: How to shut down Win98 with VB 3.0?
no problem!
-
Dec 27th, 2004, 12:41 PM
#5
Thread Starter
Member
Re: How to shut down Win98 with VB 3.0?
I have a problem, the code worked once but after I tried to do it again VB didnt recognise it so now Im stumped!!
-
Dec 27th, 2004, 12:54 PM
#6
Fanatic Member
Re: How to shut down Win98 with VB 3.0?
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
-
Dec 27th, 2004, 05:46 PM
#7
Thread Starter
Member
Re: How to shut down Win98 with VB 3.0?
Thanx that worked!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|