ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/winhost/Imports.bas
Revision: 1.3
Committed: Mon Feb 26 09:23:34 2001 UTC (23 years, 9 months ago) by pjm2
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.2: +8 -8 lines
Log Message:
Added a check for Win9x machines on startup.  We do not wish to monitor these types of
machine as they are not servers.

File Contents

# Content
1 Attribute VB_Name = "Imports"
2
3
4 #If Win32 Then
5
6 Public Declare Function GetVersionExA Lib "kernel32" _
7 (lpVersionInformation As OSVERSIONINFO) As Integer
8
9 Type SYSTEM_INFO
10 dwOemID As Long
11 dwPageSize As Long
12 lpMinimumApplicationAddress As Long
13 lpMaximumApplicationAddress As Long
14 dwActiveProcessorMask As Long
15 dwNumberOrfProcessors As Long
16 dwProcessorType As Long
17 dwAllocationGranularity As Long
18 dwReserved As Long
19 End Type
20 Type OSVERSIONINFO
21 dwOSVersionInfoSize As Long
22 dwMajorVersion As Long
23 dwMinorVersion As Long
24 dwBuildNumber As Long
25 dwPlatformId As Long
26 szCSDVersion As String * 128
27 End Type
28 Type MEMORYSTATUS
29 dwLength As Long
30 dwMemoryLoad As Long
31 dwTotalPhys As Long
32 dwAvailPhys As Long
33 dwTotalPageFile As Long
34 dwAvailPageFile As Long
35 dwTotalVirtual As Long
36 dwAvailVirtual As Long
37 End Type
38
39 ' For uptime
40 Public Declare Function GetTickCount Lib "kernel32" () As Long
41
42 Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
43 (lpVersionInformation As OSVERSIONINFO) As Long
44 Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As _
45 MEMORYSTATUS)
46 Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As _
47 SYSTEM_INFO)
48
49 Public Const PROCESSOR_INTEL_386 = 386
50 Public Const PROCESSOR_INTEL_486 = 486
51 Public Const PROCESSOR_INTEL_PENTIUM = 586
52 Public Const PROCESSOR_MIPS_R4000 = 4000
53 Public Const PROCESSOR_ALPHA_21064 = 21064
54 #Else
55 ' Constants for GetWinFlags.
56 Global Const WF_CPU286 = &H2
57 Global Const WF_CPU386 = &H4
58 Global Const WF_CPU486 = &H8
59 Global Const WF_80x87 = &H400
60 Global Const WF_STANDARD = &H10
61 Global Const WF_ENHANCED = &H20
62 Global Const WF_WINNT = &H4000
63
64 ' Type for SystemHeapInfo.
65 Type SYSHEAPINFO
66 dwSize As Long
67 wUserFreePercent As Integer
68 wGDIFreePercent As Integer
69 hUserSegment As Integer
70 hGDISegment As Integer
71 End Type
72
73 Declare Function GetVersion Lib "kernel32" () As Long
74 Declare Function GetWinFlags Lib "kernel32" () As Long
75 'Enter each of the following Declare statements as one, single line:
76 Declare Function GetFreeSpace Lib "kernel32" (ByVal wFlags As Integer) As Long
77 Declare Function GlobalCompact Lib "kernel32" (ByVal dwMinFree As Long) As Long
78 Declare Function SystemHeapInfo Lib "toolhelp.dll" (shi As SYSHEAPINFO) As Integer
79 #End If
80
81
82 Public Function GetVersion() As String
83 Dim osinfo As OSVERSIONINFO
84 Dim retvalue As Integer
85
86 osinfo.dwOSVersionInfoSize = 148
87 osinfo.szCSDVersion = Space$(128)
88 retvalue = GetVersionExA(osinfo)
89
90 With osinfo
91 Select Case .dwPlatformId
92 Case 1
93 If .dwMinorVersion = 0 Then
94 GetVersion = "Windows 95"
95 ElseIf .dwMinorVersion = 10 Then
96 GetVersion = "Windows 98"
97 End If
98 Case 2
99 If .dwMajorVersion = 3 Then
100 GetVersion = "Windows NT 3.51"
101 ElseIf .dwMajorVersion = 4 Then
102 GetVersion = "Windows NT 4.0"
103 ElseIf .dwMajorVersion = 5 Then
104 GetVersion = "Windows 2000"
105 End If
106 Case Else
107 GetVersion = "Failed"
108 End Select
109 End With
110 End Function
111