2 |
|
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX" |
3 |
|
Object = "{33155A3D-0CE0-11D1-A6B4-444553540000}#1.0#0"; "SysTray.ocx" |
4 |
|
Begin VB.Form Form1 |
5 |
< |
BorderStyle = 4 'Fixed ToolWindow |
5 |
> |
BorderStyle = 3 'Fixed Dialog |
6 |
|
Caption = "i-scream Winhost" |
7 |
|
ClientHeight = 5655 |
8 |
|
ClientLeft = 45 |
9 |
< |
ClientTop = 285 |
9 |
> |
ClientTop = 330 |
10 |
|
ClientWidth = 4710 |
11 |
+ |
Icon = "nettest.frx":0000 |
12 |
|
LinkTopic = "Form1" |
13 |
|
MaxButton = 0 'False |
14 |
+ |
MinButton = 0 'False |
15 |
|
ScaleHeight = 5655 |
16 |
|
ScaleWidth = 4710 |
17 |
|
ShowInTaskbar = 0 'False |
42 |
|
MultiLine = -1 'True |
43 |
|
ScrollBars = 2 'Vertical |
44 |
|
TabIndex = 1 |
45 |
< |
Text = "nettest.frx":0000 |
45 |
> |
Text = "nettest.frx":0742 |
46 |
|
Top = 3000 |
47 |
|
Width = 3975 |
48 |
|
End |
69 |
|
_Version = 393216 |
70 |
|
Protocol = 1 |
71 |
|
End |
72 |
+ |
Begin VB.Label Label5 |
73 |
+ |
Caption = "b e t a" |
74 |
+ |
BeginProperty Font |
75 |
+ |
Name = "MS Sans Serif" |
76 |
+ |
Size = 24 |
77 |
+ |
Charset = 0 |
78 |
+ |
Weight = 700 |
79 |
+ |
Underline = 0 'False |
80 |
+ |
Italic = 0 'False |
81 |
+ |
Strikethrough = 0 'False |
82 |
+ |
EndProperty |
83 |
+ |
Height = 615 |
84 |
+ |
Left = 240 |
85 |
+ |
TabIndex = 8 |
86 |
+ |
Top = 120 |
87 |
+ |
Width = 1815 |
88 |
+ |
End |
89 |
|
Begin VB.Label Label2 |
90 |
|
Alignment = 1 'Right Justify |
91 |
|
Caption = "Next heartbeat:" |
126 |
|
Alignment = 2 'Center |
127 |
|
Caption = "Status:" |
128 |
|
Height = 255 |
129 |
< |
Left = 120 |
129 |
> |
Left = 0 |
130 |
|
TabIndex = 2 |
131 |
|
Top = 1320 |
132 |
< |
Width = 4455 |
132 |
> |
Width = 4695 |
133 |
|
End |
134 |
|
End |
135 |
|
Attribute VB_Name = "Form1" |
142 |
|
Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long |
143 |
|
|
144 |
|
Dim filterManagerHostname As String |
145 |
< |
Dim filterManagerTCPPort As Integer |
145 |
> |
Dim filterManagerTCPPort As Long |
146 |
|
|
147 |
|
Dim seqNo As Long |
148 |
|
Dim machineName As String |
158 |
|
|
159 |
|
Dim protocolVersion As String |
160 |
|
Dim connected As Boolean |
161 |
+ |
|
162 |
+ |
'Dim CUpTime As New CUpTime |
163 |
+ |
|
164 |
|
Dim responseNumber As Integer |
165 |
|
|
166 |
|
Private Sub Form_Load() |
171 |
|
'Form1.Caption = "i-scream Winhost " & protocolVersion & " for " & GetVersion() |
172 |
|
|
173 |
|
''''TEMP |
174 |
< |
filterManagerHostname = "killigrew.ukc.ac.uk" |
175 |
< |
filterManagerTCPPort = 4567 |
174 |
> |
'filterManagerHostname = "killigrew.ukc.ac.uk" |
175 |
> |
'filterManagerTCPPort = 4567 |
176 |
|
''''' END TEMP |
177 |
|
|
178 |
< |
GoTo skip |
178 |
> |
'GoTo skip |
179 |
|
On Error GoTo iniError |
180 |
|
Dim buf As String * 256 |
181 |
|
Dim length As Long |
182 |
< |
length = GetPrivateProfileString("i-scream Winhost", "FilterManager", "<no value>", buf, Len(buf), App.Path & "winhost.ini") |
182 |
> |
length = GetPrivateProfileString("i-scream Winhost", "FilterManager", "<no value>", buf, Len(buf), App.Path & "/winhost.ini") |
183 |
|
filterManagerHostname = Left$(buf, length) |
184 |
< |
length = GetPrivateProfileString("i-scream Winhost", "FilterManagerPort", "<no value>", buf, Len(buf), App.Path & "winhost.ini") |
185 |
< |
filterManagerTCPPort = Left$(buf, length) |
184 |
> |
length = GetPrivateProfileInt("i-scream Winhost", "FilterManagerPort", 0, App.Path & "/winhost.ini") |
185 |
> |
filterManagerTCPPort = length |
186 |
> |
On Error GoTo 0 |
187 |
|
skip: |
188 |
|
|
189 |
< |
Status.Caption = "Connecting to Filter Manager" |
189 |
> |
Status.Caption = "Connecting to Filter Manager " & filterManagerHostname & ":" & filterManagerTCPPort |
190 |
|
Reconfigure_Click |
191 |
|
|
192 |
< |
Form1.Show |
192 |
> |
SystemTray.Icon = Val(Form1.Icon) |
193 |
|
SystemTray.Action = 0 |
194 |
|
|
195 |
|
|
196 |
|
Exit Sub |
197 |
|
|
198 |
|
iniError: |
199 |
< |
x = MsgBox("The i-scream Winhost could not read the correct settings from the winhost.ini file. Please correct these and try again.", 48, "Configuration not found") |
199 |
> |
x = MsgBox("The i-scream Winhost could not read the correct settings from the winhost.ini file. Please correct these and try again. " & Err.Description, 48, "Configuration not found") |
200 |
|
End |
201 |
|
|
202 |
|
End Sub |
358 |
|
' prepare the contents of the XML packet. |
359 |
|
seqNo = seqNo + 1 |
360 |
|
machineName = TCPSock.LocalHostName |
361 |
< |
localIP = TCPSock.localIP |
361 |
> |
LocalIP = TCPSock.LocalIP |
362 |
|
packetDate = Date2Num() |
363 |
|
|
364 |
|
|
404 |
|
memory& = memsts.dwAvailVirtual |
405 |
|
swapFree = memory& \ 1024 |
406 |
|
|
407 |
+ |
uptime = GetTickCount \ 1000 |
408 |
+ |
|
409 |
|
' build the contents of the XML packet |
410 |
< |
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & localIP & """>" & _ |
410 |
> |
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & LocalIP & """>" & _ |
411 |
|
"<os>" & _ |
412 |
|
"<name>" & osName & "</name>" & _ |
413 |
|
"<version>" & osVersionMajor & "</version>" & _ |
415 |
|
"<platform>" & osName & "</platform>" & _ |
416 |
|
"<minor_version>" & osVersionMinor & "</minor_version>" & _ |
417 |
|
"<processor>" & processorType & "</processor>" & _ |
418 |
+ |
"<uptime>" & uptime & "</uptime>" & _ |
419 |
|
"</os>" & _ |
420 |
|
"<memory><total>" & memTotal & "</total><free>" & memFree & "</free></memory>" & _ |
421 |
|
"<swap><total>" & swapTotal & "</total><free>" & swapFree & "</free></swap>" & _ |
422 |
< |
"" |
422 |
> |
"</packet>" |
423 |
|
Text4.Text = Text4.Text + xml |
424 |
|
|
425 |
|
' Use the first winsock control to send a UDP packet. |