Results 1 to 7 of 7

Thread: How to shut down Win98 with VB 3.0?

  1. #1

    Thread Starter
    Member MendyGreen's Avatar
    Join Date
    Dec 2004
    Location
    Baltimore, MD
    Posts
    56

    Resolved 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.

  2. #2
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: How to shut down Win98 with VB 3.0?

    VB Code:
    1. #If Win32 Then
    2.     Private Declare Function Shutdown Lib "user32" Alias _
    3.         "ExitWindowsEx" (ByVal uFlags As Long, ByVal _
    4.         dwReserved As Long) As Long
    5.     Private Const EWX_LOGOFF = 0
    6.     Private Const EWX_SHUTDOWN = 1
    7.     Private Const EWX_REBOOT = 2
    8.     Private Const EWX_FORCE = 4
    9. #Else
    10.     Private Declare Function Shutdown Lib "User" Alias _
    11.         "ExitWindows" (ByVal dwReturnCode As Long, ByVal _
    12.         wReserved As Integer) As Integer
    13.     Private Const EW_REBOOTSYSTEM = &H43
    14.     Private Const EW_RESTARTWINDOWS = &H42
    15. #End If
    16. Private Sub cmdOk_Click()
    17. Dim exit_option As Long
    18.  
    19.     exit_option = CLng(optExitOption(SelectedOption).Tag)
    20.     Shutdown EWX_SHUTDOWN 'this will Shut your computer down
    21.     'If you want to restart use one of the other Consts!
    22. End Sub
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  3. #3

    Thread Starter
    Member MendyGreen's Avatar
    Join Date
    Dec 2004
    Location
    Baltimore, MD
    Posts
    56

    Resolved Re: How to shut down Win98 with VB 3.0?

    Thanx.

  4. #4
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: How to shut down Win98 with VB 3.0?

    no problem!
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  5. #5

    Thread Starter
    Member MendyGreen's Avatar
    Join Date
    Dec 2004
    Location
    Baltimore, MD
    Posts
    56

    Unhappy 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!!

  6. #6
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711

    Re: How to shut down Win98 with VB 3.0?

    mmm...

    well, try just making it as simple as you can:
    VB Code:
    1. Private Declare Function Shutdown Lib "user32" Alias _
    2.         "ExitWindowsEx" (ByVal uFlags As Long, ByVal _
    3.         dwReserved As Long) As Long
    4.     Private Const EWX_LOGOFF = 0
    5.     Private Const EWX_SHUTDOWN = 1
    6.     Private Const EWX_REBOOT = 2
    7.     Private Const EWX_FORCE = 4
    8. Private Sub Form_Load()
    9. msg = MsgBox "Ary you shure you want to shutdown windows?", vbYesNo, "Shutdown?"
    10. If msg = vbYes Then Shutdown EWX_SHUTDOWN
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  7. #7

    Thread Starter
    Member MendyGreen's Avatar
    Join Date
    Dec 2004
    Location
    Baltimore, MD
    Posts
    56

    Resolved 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
  •  



Click Here to Expand Forum to Full Width