I have modified a shell and wait script that checks to see if a NET USE statement (run in a batch file) has taken longer than 7 seconds. However I can't think of a good way to do it. I tried the timer and that doesn't work the way I'm doing it.

If anyone has a recommendation on a way of doing it let me know.

Code:
Private Function shellAndWait(ByVal fileName As String) As Long
    Dim executionStatus As Long
    Dim processHandle As Long
    Timer1.Interval = 1000
    Timer1.Enabled = True
    timercnt = 1
    'Execute the application/file, but HIDE the window
    executionStatus = Shell(fileName, vbNormalFocus)
    
    'Get the Process Handle
    processHandle = OpenProcess(&H100000, True, executionStatus)
 
    'Wait till the application is finished
    Do
        returnValue = WaitForSingleObject(processHandle, 50)
        DoEvents
        If bCancel Then
            SendMessage FindWindow(WinCmdPath, vbNullString), WM_CLOSE, 0&, 0&
            returnValue = -1
            Exit Do
        End If
    Loop Until returnValue = 0
    If returnValue = 0 Then
        Timer1.Enabled = False
        timercnt = 1
    End If
    bCancel = False
    shellAndWait = returnValue
End Function
Private Sub Timer1_Timer()
    If timercnt = 7 Then
        bCancel = True
        timercnt = 1
    Else
        timercnt = timercnt + 1
    End If
End Sub