118 |
|
Attribute VB_Creatable = False |
119 |
|
Attribute VB_PredeclaredId = True |
120 |
|
Attribute VB_Exposed = False |
121 |
+ |
' For the system tray bits |
122 |
|
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long |
123 |
|
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 |
124 |
|
|
146 |
|
protocolVersion = "1.1" |
147 |
|
|
148 |
|
Status.Caption = "Loading" |
149 |
< |
Form1.Caption = "i-scream Winhost " & protocolVersion |
149 |
> |
'Form1.Caption = "i-scream Winhost " & protocolVersion & " for " & GetVersion() |
150 |
|
|
151 |
|
''''TEMP |
152 |
|
filterManagerHostname = "killigrew.ukc.ac.uk" |
166 |
|
Status.Caption = "Connecting to Filter Manager" |
167 |
|
Reconfigure_Click |
168 |
|
|
169 |
+ |
Form1.Show |
170 |
+ |
SystemTray.Action = 0 |
171 |
+ |
|
172 |
+ |
|
173 |
|
Exit Sub |
174 |
|
|
175 |
|
iniError: |
182 |
|
x = MsgBox("Are you sure you want to shut down the Winhost? This will stop your computer sending information to the i-scream Central Monitoring System.", vbYesNo, "i-scream Winhost") |
183 |
|
If x = 7 Then |
184 |
|
Cancel = True |
185 |
+ |
Else |
186 |
+ |
SystemTray.Action = 2 |
187 |
|
End If |
181 |
– |
SystemTray.Action = 2 |
188 |
|
|
189 |
|
End Sub |
190 |
|
|
191 |
|
Private Sub Hide_Click() |
192 |
|
Form1.Visible = False |
193 |
|
SystemTray.Icon = Val(Form1.Icon) |
188 |
– |
SystemTray.Action = 0 |
194 |
|
End Sub |
195 |
|
|
196 |
|
Private Sub Reconfigure_Click() |
205 |
|
Private Sub SystemTray_MouseDblClk(ByVal Button As Integer) |
206 |
|
|
207 |
|
Form1.Visible = True |
203 |
– |
SystemTray.Action = 2 |
208 |
|
Form1.SetFocus |
209 |
|
|
210 |
|
|
331 |
|
Status.Caption = "" |
332 |
|
|
333 |
|
If Label3.Caption < 1 Then |
334 |
< |
' build the contents of the XML packet. |
335 |
< |
localIP = TCPSock.localIP |
332 |
< |
machineName = TCPSock.LocalHostName |
334 |
> |
|
335 |
> |
' prepare the contents of the XML packet. |
336 |
|
seqNo = seqNo + 1 |
337 |
+ |
machineName = TCPSock.LocalHostName |
338 |
+ |
localIP = TCPSock.localIP |
339 |
|
packetDate = Date2Num() |
340 |
+ |
|
341 |
+ |
|
342 |
+ |
Dim verinfo As OSVERSIONINFO |
343 |
+ |
verinfo.dwOSVersionInfoSize = Len(verinfo) |
344 |
+ |
ret% = GetVersionEx(verinfo) |
345 |
+ |
If ret% = 0 Then |
346 |
+ |
MsgBox "Error getting Windows version Information" |
347 |
+ |
End |
348 |
+ |
End If |
349 |
+ |
|
350 |
+ |
osName = getVersion() |
351 |
+ |
osVersionMajor = verinfo.dwMajorVersion |
352 |
+ |
osVersionMinor = verinfo.dwMinorVersion |
353 |
+ |
osBuild = verinfo.dwBuildNumber |
354 |
+ |
|
355 |
+ |
Dim sysinfo As SYSTEM_INFO |
356 |
+ |
GetSystemInfo sysinfo |
357 |
+ |
Select Case sysinfo.dwProcessorType |
358 |
+ |
Case PROCESSOR_INTEL_386 |
359 |
+ |
processorType = "Intel 386" |
360 |
+ |
Case PROCESSOR_INTEL_486 |
361 |
+ |
processorType = "Intel 486" |
362 |
+ |
Case PROCESSOR_INTEL_PENTIUM |
363 |
+ |
processorType = "Intel Pentium variant" |
364 |
+ |
Case PROCESSOR_MIPS_R4000 |
365 |
+ |
processorType = "MIPS R4000" |
366 |
+ |
Case PROCESSOR_ALPHA_21064 |
367 |
+ |
processorType = "DEC Alpha 21064" |
368 |
+ |
Case Else |
369 |
+ |
processorType = "(unknown)" |
370 |
+ |
End Select |
371 |
+ |
|
372 |
+ |
Dim memsts As MEMORYSTATUS |
373 |
+ |
Dim memory& |
374 |
+ |
GlobalMemoryStatus memsts |
375 |
+ |
memory& = memsts.dwTotalPhys |
376 |
+ |
memTotal = memory& \ 1024 |
377 |
+ |
memory& = memsts.dwAvailPhys |
378 |
+ |
memFree = memory& \ 1024 |
379 |
+ |
memory& = memsts.dwTotalVirtual |
380 |
+ |
swapTotal = memory& \ 1024 |
381 |
+ |
memory& = memsts.dwAvailVirtual |
382 |
+ |
swapFree = memory& \ 1024 |
383 |
+ |
|
384 |
+ |
' build the contents of the XML packet |
385 |
|
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & localIP & """>" & _ |
386 |
< |
"" & _ |
387 |
< |
"" & _ |
388 |
< |
"" & _ |
389 |
< |
"" & _ |
390 |
< |
"" & _ |
391 |
< |
"" & _ |
392 |
< |
"" & _ |
393 |
< |
"" & _ |
394 |
< |
"" & _ |
395 |
< |
"" & _ |
346 |
< |
"" & _ |
347 |
< |
"" & _ |
348 |
< |
"" & _ |
349 |
< |
"" & _ |
386 |
> |
"<os>" & _ |
387 |
> |
"<name>" & osName & "</name>" & _ |
388 |
> |
"<version>" & osVersionMajor & "</version>" & _ |
389 |
> |
"<release>" & osBuild & "</release>" & _ |
390 |
> |
"<platform>" & osName & "</platform>" & _ |
391 |
> |
"<minor_version>" & osVersionMinor & "</minor_version>" & _ |
392 |
> |
"<processor>" & processorType & "</processor>" & _ |
393 |
> |
"</os>" & _ |
394 |
> |
"<memory><total>" & memTotal & "</total><free>" & memFree & "</free></memory>" & _ |
395 |
> |
"<swap><total>" & swapTotal & "</total><free>" & swapFree & "</free></swap>" & _ |
396 |
|
"" |
397 |
|
Text4.Text = Text4.Text + xml |
398 |
|
|