ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/host/vb_net_test/Imports.bas
Revision: 1.1
Committed: Fri Feb 23 17:10:17 2001 UTC (23 years, 2 months ago) by pjm2
Branch: MAIN
Log Message:
Used by the winhost - contains most of the API methods that are used to obtain system
information.

File Contents

# User Rev Content
1 pjm2 1.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     Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
40     (lpVersionInformation As OSVERSIONINFO) As Long
41     Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As _
42     MEMORYSTATUS)
43     Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As _
44     SYSTEM_INFO)
45    
46     Public Const PROCESSOR_INTEL_386 = 386
47     Public Const PROCESSOR_INTEL_486 = 486
48     Public Const PROCESSOR_INTEL_PENTIUM = 586
49     Public Const PROCESSOR_MIPS_R4000 = 4000
50     Public Const PROCESSOR_ALPHA_21064 = 21064
51     #Else
52     ' Constants for GetWinFlags.
53     Global Const WF_CPU286 = &H2
54     Global Const WF_CPU386 = &H4
55     Global Const WF_CPU486 = &H8
56     Global Const WF_80x87 = &H400
57     Global Const WF_STANDARD = &H10
58     Global Const WF_ENHANCED = &H20
59     Global Const WF_WINNT = &H4000
60    
61     ' Type for SystemHeapInfo.
62     Type SYSHEAPINFO
63     dwSize As Long
64     wUserFreePercent As Integer
65     wGDIFreePercent As Integer
66     hUserSegment As Integer
67     hGDISegment As Integer
68     End Type
69    
70     Declare Function getVersion Lib "kernel32" Alias "GetVersion" () As Long
71     Declare Function GetWinFlags Lib "kernel32" () As Long
72     'Enter each of the following Declare statements as one, single line:
73     Declare Function GetFreeSpace Lib "kernel32" (ByVal wFlags As Integer) As Long
74     Declare Function GlobalCompact Lib "kernel32" (ByVal dwMinFree As Long) As Long
75     Declare Function SystemHeapInfo Lib "toolhelp.dll" (shi As SYSHEAPINFO) As Integer
76     #End If
77    
78    
79     Public Function getVersion() As String
80     Dim osinfo As OSVERSIONINFO
81     Dim retvalue As Integer
82    
83     osinfo.dwOSVersionInfoSize = 148
84     osinfo.szCSDVersion = Space$(128)
85     retvalue = GetVersionExA(osinfo)
86    
87     With osinfo
88     Select Case .dwPlatformId
89     Case 1
90     If .dwMinorVersion = 0 Then
91     getVersion = "Windows 95"
92     ElseIf .dwMinorVersion = 10 Then
93     getVersion = "Windows 98"
94     End If
95     Case 2
96     If .dwMajorVersion = 3 Then
97     getVersion = "Windows NT 3.51"
98     ElseIf .dwMajorVersion = 4 Then
99     getVersion = "Windows NT 4.0"
100     ElseIf .dwMajorVersion = 5 Then
101     getVersion = "Windows 2000"
102     End If
103     Case Else
104     getVersion = "Failed"
105     End Select
106     End With
107     End Function
108