1 |
joko |
1.1 |
VERSION 5.00 |
2 |
|
|
Begin VB.Form Form_Main |
3 |
|
|
Caption = "VpnDial" |
4 |
|
|
ClientHeight = 3525 |
5 |
joko |
1.3 |
ClientLeft = 165 |
6 |
|
|
ClientTop = 735 |
7 |
joko |
1.1 |
ClientWidth = 6450 |
8 |
joko |
1.3 |
Icon = "Form_Main.frx":0000 |
9 |
joko |
1.1 |
LinkTopic = "Form1" |
10 |
|
|
ScaleHeight = 3525 |
11 |
|
|
ScaleWidth = 6450 |
12 |
|
|
StartUpPosition = 3 'Windows Default |
13 |
|
|
Begin VB.CommandButton Command_RunScript |
14 |
|
|
Caption = "&Run Script" |
15 |
|
|
Height = 345 |
16 |
|
|
Left = 4770 |
17 |
|
|
TabIndex = 4 |
18 |
|
|
Top = 1560 |
19 |
|
|
Width = 1605 |
20 |
|
|
End |
21 |
|
|
Begin VB.CommandButton Command_RouteAdd |
22 |
|
|
Caption = "&Add Route" |
23 |
|
|
Height = 345 |
24 |
|
|
Left = 4770 |
25 |
|
|
TabIndex = 3 |
26 |
|
|
Top = 1140 |
27 |
|
|
Width = 1605 |
28 |
|
|
End |
29 |
|
|
Begin VB.CommandButton Command_Hangup |
30 |
|
|
Caption = "&Hangup" |
31 |
|
|
Height = 345 |
32 |
|
|
Left = 4770 |
33 |
|
|
TabIndex = 2 |
34 |
|
|
Top = 510 |
35 |
|
|
Width = 1605 |
36 |
|
|
End |
37 |
|
|
Begin VB.CommandButton Command_Dial |
38 |
|
|
Caption = "&Dial" |
39 |
|
|
Height = 345 |
40 |
|
|
Left = 4770 |
41 |
|
|
TabIndex = 1 |
42 |
|
|
Top = 90 |
43 |
|
|
Width = 1605 |
44 |
|
|
End |
45 |
|
|
Begin VB.ListBox List_Connections |
46 |
|
|
Height = 3375 |
47 |
|
|
Left = 60 |
48 |
|
|
TabIndex = 0 |
49 |
|
|
Top = 60 |
50 |
|
|
Width = 4605 |
51 |
|
|
End |
52 |
joko |
1.3 |
Begin VB.Menu MenuPopup |
53 |
|
|
Caption = "" |
54 |
|
|
Begin VB.Menu MenuExit |
55 |
|
|
Caption = "&Exit VpnDial" |
56 |
|
|
End |
57 |
|
|
End |
58 |
joko |
1.1 |
End |
59 |
|
|
Attribute VB_Name = "Form_Main" |
60 |
|
|
Attribute VB_GlobalNameSpace = False |
61 |
|
|
Attribute VB_Creatable = False |
62 |
|
|
Attribute VB_PredeclaredId = True |
63 |
|
|
Attribute VB_Exposed = False |
64 |
|
|
' use http://www.codeproject.com/staticctrl/gifanimation.asp ??? |
65 |
|
|
|
66 |
|
|
Option Explicit |
67 |
|
|
|
68 |
|
|
Private Sub Form_Load() |
69 |
joko |
1.3 |
' Dim rasItem As RasEntryData |
70 |
|
|
' For Each rasItem In RasEntries |
71 |
|
|
' List_Connections.AddItem rasItem.entryname |
72 |
|
|
' Next |
73 |
|
|
End Sub |
74 |
|
|
|
75 |
|
|
Private Sub Form_Unload(Cancel As Integer) |
76 |
|
|
RemoveTrayIcon |
77 |
|
|
End Sub |
78 |
|
|
|
79 |
|
|
' TrayIcon specific implementation |
80 |
|
|
Private Sub Form_MouseMove(Button As Integer, _ |
81 |
|
|
Shift As Integer, X As Single, Y As Single) |
82 |
|
|
|
83 |
|
|
' Das MouseMove Ereignis wird ausgelöst, wenn die |
84 |
|
|
' Maus über das Symbol im Systray geführt wird |
85 |
|
|
|
86 |
|
|
Dim lMsg As Long |
87 |
|
|
Dim sFilter As String |
88 |
|
|
|
89 |
|
|
lMsg = X / Screen.TwipsPerPixelX |
90 |
|
|
Select Case lMsg |
91 |
|
|
Case WM_LBUTTONDOWN |
92 |
|
|
' linke Maustaste wird gedrückt |
93 |
|
|
|
94 |
|
|
Case WM_LBUTTONUP |
95 |
|
|
' linke Maustaste wird losgelassen |
96 |
|
|
'MsgBox "click" |
97 |
|
|
|
98 |
|
|
Case WM_LBUTTONDBLCLK |
99 |
|
|
' linke Maustaste - Doppelklick |
100 |
|
|
|
101 |
|
|
Case WM_RBUTTONDOWN |
102 |
|
|
' rechte Maustaste wird gedrückt |
103 |
|
|
|
104 |
|
|
Case WM_RBUTTONUP |
105 |
joko |
1.4 |
' rechte Maustaste wird losgelassen |
106 |
|
|
' (jetzt z.B. Popup-Menü öffnen) |
107 |
|
|
|
108 |
|
|
' handle hiding of popup-menu (see http://www.vbcity.com/forums/topic.asp?tid=36205) |
109 |
|
|
Dim hProcess As Long |
110 |
|
|
GetWindowThreadProcessId hwnd, hProcess |
111 |
|
|
AppActivate hProcess |
112 |
|
|
'SetForegroundWindow (Me.hwnd) |
113 |
|
|
|
114 |
|
|
PopupMenu MenuPopup |
115 |
joko |
1.3 |
|
116 |
|
|
Case WM_RBUTTONDBLCLK |
117 |
|
|
' rechte Maustaste - Doppeklick |
118 |
|
|
|
119 |
|
|
End Select |
120 |
|
|
End Sub |
121 |
|
|
|
122 |
|
|
Private Sub MenuExit_Click() |
123 |
|
|
' Symbol aus dem Systray entfernen |
124 |
|
|
RemoveTrayIcon |
125 |
|
|
' Beenden |
126 |
|
|
End |
127 |
joko |
1.1 |
End Sub |
128 |
|
|
|
129 |
joko |
1.3 |
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
' ========================================================== |
133 |
|
|
' old code from here |
134 |
|
|
' ========================================================== |
135 |
|
|
|
136 |
|
|
|
137 |
joko |
1.1 |
Private Sub Command_Dial_Click() |
138 |
|
|
|
139 |
|
|
Dim conName As String, rasItem As RasEntryData |
140 |
|
|
Dim success As Boolean |
141 |
|
|
|
142 |
|
|
'InternetConnect "dachboden" |
143 |
|
|
'success = RasConnect("dachboden", "C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Microsoft\Network\Connections\Pbk\rasphone.pbk") |
144 |
|
|
|
145 |
|
|
conName = List_Connections.Text |
146 |
|
|
|
147 |
|
|
If (conName = "") Then |
148 |
|
|
MsgBox "Bitte Eintrag auswählen!" |
149 |
|
|
Exit Sub |
150 |
|
|
End If |
151 |
|
|
|
152 |
|
|
Set rasItem = RasEntries(conName) |
153 |
|
|
success = RasConnect(rasItem.entryname, rasItem.PhonebookPath) |
154 |
|
|
|
155 |
|
|
Dim ClientIP As String |
156 |
|
|
If (success = True) Then |
157 |
joko |
1.2 |
ClientIP = DetermineClientIP(rasItem.entryname) |
158 |
joko |
1.1 |
MsgBox "Eingewählt: " & ClientIP, , "Status" |
159 |
|
|
Else |
160 |
|
|
MsgBox "Fehler bei der Einwahl!", , "Status" |
161 |
|
|
End If |
162 |
|
|
|
163 |
|
|
'Picture_Animation.Appearance= |
164 |
|
|
|
165 |
|
|
End Sub |
166 |
|
|
|
167 |
|
|
Private Sub Command_Hangup_Click() |
168 |
|
|
|
169 |
|
|
Dim conName As String |
170 |
|
|
Dim success As Boolean |
171 |
|
|
|
172 |
|
|
conName = List_Connections.Text |
173 |
|
|
|
174 |
|
|
If (conName = "") Then |
175 |
|
|
MsgBox "Bitte Eintrag auswählen!" |
176 |
|
|
Exit Sub |
177 |
|
|
End If |
178 |
|
|
|
179 |
|
|
'Set rasItem = RasEntries(conName) |
180 |
|
|
success = RasDisconnect(conName) |
181 |
|
|
If (success = True) Then |
182 |
|
|
MsgBox "Verbindung getrennt.", , "Status" |
183 |
|
|
End If |
184 |
|
|
|
185 |
|
|
End Sub |
186 |
|
|
|
187 |
|
|
Private Sub Command_RouteAdd_Click() |
188 |
|
|
MsgBox RouteAdd(0, "192.168.11.0", "255.255.255.0", "192.168.13.1") |
189 |
|
|
End Sub |
190 |
|
|
|