--- joko/ToolBox/Windows/VpnDial/src/Module_Main.bas 2005/10/08 01:01:45 1.7 +++ joko/ToolBox/Windows/VpnDial/src/Module_Main.bas 2005/10/09 18:42:25 1.8 @@ -87,7 +87,13 @@ conName = cmdline.getArgument("setup") If conName <> "" Then + On Error Resume Next Set rasItem = RasEntries(conName) + If Err.Number <> 0 Then + MsgBox "Error while accessing RAS entry """ & conName & """." & vbCrLf & "Probably it does not exist?" + End + End If + On Error GoTo 0 If cmdline.hasSwitch("gui") Then With Form_Credentials @@ -130,6 +136,11 @@ 'RasRetrieveConnectionHandler conName ConnectionName = conName ConnectionOnline = RasIsOnline(conName) + + If cmdline.hasSwitch("gui") Then + ShowTrayIcon Form_Main, getTrayIconTipText(ConnectionName, ConnectionOnline) + End If + MonitorRASStatusAsync End If @@ -158,7 +169,13 @@ rasItem.PhonebookPath = curEntry.PhonebookPath rasItem.Win2000_SystemPhonebook = curEntry.Win2000_SystemPhonebook + 'MsgBox rasItem.entryname + 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." + End If + On Error GoTo 0 Next i End Sub @@ -210,5 +227,19 @@ End If ConnectionOnline = isOnline + + UpdateTrayIcon getTrayIconTipText(ConnectionName, ConnectionOnline) + End If End Sub + +Private Function getTrayIconTipText(conName As String, isOnline As Boolean) As String + Dim TipText As String + TipText = "VpnDial monitoring """ & conName & """: " + If isOnline Then + TipText = TipText & "online" + Else + TipText = TipText & "offline" + End If + getTrayIconTipText = TipText +End Function