--- joko/ToolBox/Windows/VpnDial/src/Module_Main.bas 2005/10/09 18:42:25 1.8 +++ joko/ToolBox/Windows/VpnDial/src/Module_Main.bas 2005/11/22 22:20:11 1.9 @@ -52,29 +52,8 @@ ' Form_Main.Show 'Else - ' dial command - If cmdline.hasSwitch("dial") Then - - conName = cmdline.getArgument("dial") - On Error Resume Next - Set rasItem = RasEntries(conName) - If Err.Number = 0 Then - success = RasConnect(rasItem.entryname, rasItem.PhonebookPath) - Else - MsgBox "Unkown RAS-Connection """ & conName & """." - End If - On Error GoTo 0 - - ' hangup command - ElseIf cmdline.hasSwitch("hangup") Then - conName = cmdline.getArgument("hangup") - success = RasDisconnect(conName) - 'MsgBox success - - 'End If - ' run script - ElseIf cmdline.hasSwitch("script") And success = True Then + If cmdline.hasSwitch("script") And success = True Then script_name = cmdline.getArgument("script") If script_name <> "" Then script_args = Chr(34) & DetermineClientIP(conName) & Chr(34) & " " & Chr(34) & DetermineServerIP(conName) & Chr(34) @@ -141,9 +120,27 @@ ShowTrayIcon Form_Main, getTrayIconTipText(ConnectionName, ConnectionOnline) End If + ' dial command + If cmdline.hasSwitch("dial") Then + doDial conName + End If + + ' monitor ras connection MonitorRASStatusAsync + End If + ' dial command + ElseIf cmdline.hasSwitch("dial") Then + conName = cmdline.getArgument("dial") + doDial conName + + ' hangup command + ElseIf cmdline.hasSwitch("hangup") Then + conName = cmdline.getArgument("hangup") + success = RasDisconnect(conName) + 'MsgBox success + End If 'End If @@ -173,7 +170,7 @@ On Error Resume Next RasEntries.add rasItem, rasItem.entryname If Err.Number = 457 Then - MsgBox "Error: Duplicate RAS entry. Don't know what to dial. This error should not occour." + 'MsgBox "Error: Duplicate RAS entry. Don't know what to dial. This error should not occour." End If On Error GoTo 0 Next i @@ -243,3 +240,20 @@ End If getTrayIconTipText = TipText End Function + + +Private Function doDial(conName As String) + + Dim rasItem As RasEntryData + Dim success As Boolean + + On Error Resume Next + Set rasItem = RasEntries(conName) + If Err.Number = 0 Then + success = RasConnect(rasItem.entryname, rasItem.PhonebookPath) + Else + MsgBox "Unknown RAS-Connection """ & conName & """." + End If + On Error GoTo 0 + +End Function