8 |
|
ClientLeft = 45 |
9 |
|
ClientTop = 330 |
10 |
|
ClientWidth = 4710 |
11 |
+ |
Icon = "nettest.frx":0000 |
12 |
|
LinkTopic = "Form1" |
13 |
|
MaxButton = 0 'False |
14 |
|
MinButton = 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 |
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 |
159 |
|
Dim protocolVersion As String |
160 |
|
Dim connected As Boolean |
161 |
|
|
162 |
< |
'Dim CUpTime As New CUpTime |
162 |
> |
Dim CUpTime As New CUpTime |
163 |
|
|
164 |
|
Dim responseNumber As Integer |
165 |
|
|
166 |
|
Private Sub Form_Load() |
167 |
|
|
168 |
+ |
If App.PrevInstance Then |
169 |
+ |
x = MsgBox("There is already an i-scream Winhost running on this machine.", 48, "i-scream host already running") |
170 |
+ |
End If |
171 |
+ |
|
172 |
|
protocolVersion = "1.1" |
173 |
|
|
174 |
|
Status.Caption = "Loading" |
175 |
< |
'Form1.Caption = "i-scream Winhost " & protocolVersion & " for " & GetVersion() |
175 |
> |
Form1.Caption = "i-scream Winhost " & protocolVersion |
176 |
|
|
177 |
+ |
Form1.Show |
178 |
+ |
|
179 |
+ |
CUpTime.Init |
180 |
+ |
|
181 |
+ |
If CUpTime.isWin9x Then |
182 |
+ |
x = MsgBox("Sorry, the i-scream host can only be used to monitor servers (i.e. not Win9x)", 48, "Not a server.") |
183 |
+ |
End |
184 |
+ |
End If |
185 |
+ |
|
186 |
|
''''TEMP |
187 |
< |
filterManagerHostname = "killigrew.ukc.ac.uk" |
188 |
< |
filterManagerTCPPort = 4567 |
187 |
> |
'filterManagerHostname = "killigrew.ukc.ac.uk" |
188 |
> |
'filterManagerTCPPort = 4567 |
189 |
|
''''' END TEMP |
190 |
|
|
191 |
< |
GoTo skip |
191 |
> |
'GoTo skip |
192 |
|
On Error GoTo iniError |
193 |
|
Dim buf As String * 256 |
194 |
|
Dim length As Long |
195 |
< |
length = GetPrivateProfileString("i-scream Winhost", "FilterManager", "<no value>", buf, Len(buf), App.Path & "winhost.ini") |
195 |
> |
length = GetPrivateProfileString("i-scream Winhost", "FilterManager", "<no value>", buf, Len(buf), App.Path & "/winhost.ini") |
196 |
|
filterManagerHostname = Left$(buf, length) |
197 |
< |
length = GetPrivateProfileString("i-scream Winhost", "FilterManagerPort", "<no value>", buf, Len(buf), App.Path & "winhost.ini") |
198 |
< |
filterManagerTCPPort = Left$(buf, length) |
197 |
> |
length = GetPrivateProfileInt("i-scream Winhost", "FilterManagerPort", 0, App.Path & "/winhost.ini") |
198 |
> |
filterManagerTCPPort = length |
199 |
> |
On Error GoTo 0 |
200 |
|
skip: |
201 |
|
|
202 |
< |
Status.Caption = "Connecting to Filter Manager" |
202 |
> |
Status.Caption = "Connecting to Filter Manager " & filterManagerHostname & ":" & filterManagerTCPPort |
203 |
|
Reconfigure_Click |
204 |
|
|
205 |
< |
Form1.Show |
205 |
> |
SystemTray.Icon = Val(Form1.Icon) |
206 |
|
SystemTray.Action = 0 |
207 |
|
|
208 |
|
|
209 |
|
Exit Sub |
210 |
|
|
211 |
|
iniError: |
212 |
< |
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") |
212 |
> |
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") |
213 |
|
End |
214 |
|
|
215 |
|
End Sub |
383 |
|
End |
384 |
|
End If |
385 |
|
|
386 |
< |
osName = getVersion() |
386 |
> |
osName = GetVersion() |
387 |
|
osVersionMajor = verinfo.dwMajorVersion |
388 |
|
osVersionMinor = verinfo.dwMinorVersion |
389 |
|
osBuild = verinfo.dwBuildNumber |
417 |
|
memory& = memsts.dwAvailVirtual |
418 |
|
swapFree = memory& \ 1024 |
419 |
|
|
420 |
+ |
uptime = GetTickCount \ 1000 |
421 |
+ |
|
422 |
+ |
CUpTime.Capture |
423 |
+ |
cpu_time = CUpTime.CPUTime |
424 |
+ |
percent_idle = CUpTime.PercentIdle |
425 |
+ |
|
426 |
|
' build the contents of the XML packet |
427 |
|
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & LocalIP & """>" & _ |
428 |
|
"<os>" & _ |
432 |
|
"<platform>" & osName & "</platform>" & _ |
433 |
|
"<minor_version>" & osVersionMinor & "</minor_version>" & _ |
434 |
|
"<processor>" & processorType & "</processor>" & _ |
435 |
+ |
"<uptime>" & uptime & "</uptime>" & _ |
436 |
|
"</os>" & _ |
437 |
+ |
"<cpu><idle>" & percent_idle & "</idle><user>" & cpu_time & "</user></cpu>" & _ |
438 |
|
"<memory><total>" & memTotal & "</total><free>" & memFree & "</free></memory>" & _ |
439 |
|
"<swap><total>" & swapTotal & "</total><free>" & swapFree & "</free></swap>" & _ |
440 |
|
"</packet>" |