Hi everyone,

I have used this site once previously and you guys were able to figure it out really quickly so I hope I can get the same results this time. I wish I could give back help to this site but I doubt I'm in a position of expertise to do so. xD

Background:

I have already made a program that opens and closes web browsers to designated pages at on one minute intervals, kind of like a macro, (to get views, kind of like youtube views).

I have this program set up to read from a file that the user can edit to add or delete urls in the file and right now there are a quite a bit of urls. The program takes a bit of time to do everything it needs to do so I just let it run over night and turn of my computer in the morning.

Problem:

However, I would like to be able to make my program automatically turn off/standby/hibernate when its done doing its thang.



I have looked around for a few hours and tried several coding samples such as

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 SelectedOption As Integer

Private Sub Form_Load()
    #If Win32 Then
        ' Prepare for 32 bit ExitWindowsEx.
        optExitOption(0).Caption = "Normal Shutdown"
        optExitOption(0).Tag = EWX_SHUTDOWN

        optExitOption(1).Caption = "Reboot"
        optExitOption(1).Tag = EWX_REBOOT
        
        optExitOption(2).Caption = "Log Off"
        optExitOption(2).Tag = EWX_LOGOFF
        
        optExitOption(3).Caption = "Forced Shutdown"
        optExitOption(3).Tag = EWX_FORCE
    #Else
        ' Prepare for 16 bit ExitWindows.
        optExitOption(0).Caption = "Normal Shutdown"
        optExitOption(0).Tag = 0

        optExitOption(1).Caption = "Reboot"
        optExitOption(1).Tag = EW_REBOOTSYSTEM

        optExitOption(2).Caption = "Restart Windows"
        optExitOption(2).Tag = EW_RESTARTWINDOWS
        
        optExitOption(3).Visible = False
    #End If
End Sub

Private Sub cmdOk_Click()
Dim exit_option As Long

    exit_option = CLng(optExitOption(SelectedOption).Tag)
    'MsgBox ("")
    Shutdown exit_option, 0
End Sub
(which I believe I found on this site)

and

Code:
Private Sub Command1_Click()
Shell _
("Rundll32.exe user,_exitwindows")
End Sub
I am not too experienced in VB (mostly self taught) but I have managed to make something that can shell a program and i/o files and info so its not like I'm learning how to use a command button to display "Hello World!"

Any help is greatly appreciated