'make a form with a label on
it
'put the code in the appropiate places
'form1 general section
Option Explicit
Dim dosver$, winver$, windir$, sysdir$
Dim sdir$, wmode$, mchip$, defdir$
Dim MemTotaal$, MemBeschikbaar$, MemVirtueelTotaal$, MemVirtueelBeschikbaar$
Dim vTekst$
Private sub
Form_Load()
dim
msg as
String
dim
ret%, buffer$
dim
ver_major$, ver_minor$, build$
vTekst$ = "System Information" & vbCrLf & vbCrLf
' Get windowsdirectory
buffer$ = Space(255)
ret% = GetWindowsDirectory(buffer, 255)
windir$ = Left$(buffer$, ret%)
vTekst$ = vTekst$ & "windowsdirectory: " & windir$ & vbCrLf
buffer$ = Space(255)
ret% = GetSystemDirectory(buffer, 255)
sysdir$ = Left$(buffer$, ret%)
vTekst$ = vTekst$ & "windows-systemdirectory: " & sysdir$ & vbCrLf
buffer$ = Environ("temp")
vTekst$ = vTekst$ & "tempory-directory: " & buffer$ & vbCrLf
' Get operating system and version.
dim
verinfo as
OSVERSIONINFO
verinfo.dwOSVersionInfoSize = Len(verinfo)
ret% = GetVersionEx(verinfo)
If ret% = 0 Then
MsgBox "Error Getting Version Information"
Exit Sub
end
If
select
case
verinfo.dwPlatformId
case
0
winver$ = "Windows 32s "
case
1
winver$ = "Windows 95 "
case
2
winver$ = "Windows NT "
end
Select
vTekst$ = vTekst$ & "operating system: " & winver$ & vbCrLf
ver_major$ = verinfo.dwMajorVersion
ver_minor$ = verinfo.dwMinorVersion
build$ = verinfo.dwBuildNumber
dosver$ = ver_major$ + "." + ver_minor$
dosver$ = dosver$ + " (Build " + build$ + ")"
vTekst$ = vTekst$ & "windows-version: " & dosver$ & vbCrLf
' Get CPU type
and operating mode.
dim
sysinfo as
SYSTEM_INFO
GetSystemInfo sysinfo
select
case
sysinfo.dwProcessorType
case
PROCESSOR_INTEL_386
mchip$ = "Intel 386"
case
PROCESSOR_INTEL_486
mchip$ = "Intel 486"
case
PROCESSOR_INTEL_PENTIUM
mchip$ = "Intel Pentium"
case
PROCESSOR_MIPS_R4000
mchip$ = "MIPS R4000"
case
PROCESSOR_ALPHA_21064
mchip$ = "DEC Alpha 21064"
case
Else
mchip$ = "(unknown)"
end
Select
vTekst$ = vTekst$ & "processor: " & mchip$ & vbCrLf
' Get free memory.
dim
memsts as
MEMORYSTATUS
dim
memory&
GlobalMemoryStatus memsts
memory& = memsts.dwTotalPhys
MemTotaal = Format$(memory& \ 1024, "###,###,###") + "K"
vTekst$ = vTekst$ & "Total Memory: " & MemTotaal$ & vbCrLf
memory& = memsts.dwAvailPhys
MemBeschikbaar = Format$(memory& \ 1024, "###,###,###") + "K"
vTekst$ = vTekst$ & "Free Memory: " & MemBeschikbaar$ & vbCrLf
memory& = memsts.dwTotalVirtual
MemVirtueelTotaal = Format$(memory& \ 1024, "###,###,###") + "K"
vTekst$ = vTekst$ & "Virtual Memory: " & MemVirtueelTotaal$ & vbCrLf
memory& = memsts.dwAvailVirtual
MemVirtueelBeschikbaar = Format$(memory& \ 1024, "###,###,###") + "K"
vTekst$ = vTekst$ & "Free Virtual Memory:" & MemVirtueelBeschikbaar$ & vbCrLf & vbCrLf
vTekst$ = vTekst$ & "application: " & App.EXEName & vbCrLf
vTekst$ = vTekst$ & "location: " & App.Path & vbCrLf
vTekst$ = vTekst$ & "version: " & App.Major & "." & App.Minor & " (" & App.Revision & ")" & vbCrLf
vTekst$ = vTekst$ & App.CompanyName & vbCrLf
vTekst$ = vTekst$ & App.LegalCopyright & vbCrLf
vTekst$ = vTekst$ & App.LegalTrademarks & vbCrLf
'also App.Title, App.Comments, App.Produktname... just see the helpfile on
App
MousePointer = vbNormal
Label1.Caption = vTekst$
End Sub
'on a moduleform
Type SYSTEM_INFO
dwOemID as
Long
dwPageSize as
Long
lpMinimumApplicationAddress as
Long
lpMaximumApplicationAddress as
Long
dwActiveProcessorMask as
Long
dwNumberOrfProcessors as
Long
dwProcessorType as
Long
dwAllocationGranularity as
Long
dwReserved as
Long
End Type
Type OSVERSIONINFO
dwOSVersionInfoSize as
Long
dwMajorVersion as
Long
dwMinorVersion as
Long
dwBuildNumber as
Long
dwPlatformId as
Long
szCSDVersion as
String * 128
End Type
Type MEMORYSTATUS
dwLength as
Long
dwMemoryLoad as
Long
dwTotalPhys as
Long
dwAvailPhys as
Long
dwTotalPageFile as
Long
dwAvailPageFile as
Long
dwTotalVirtual as
Long
dwAvailVirtual as
Long
End Type
Declare Function GetSystemDirectory Lib "kernel32" alias
"GetSystemDirectoryA" (ByVal lpBuffer as
String, ByVal nSize as
Long) as
Long
Declare Function GetWindowsDirectory Lib "kernel32" alias
"GetWindowsDirectoryA" (ByVal lpBuffer as
String, ByVal nSize as
Long) as
Long
Declare Function GetFileVersionInfo Lib "version.dll" alias
"GetFileVersionInfoA" (ByVal lptstrFilename as
String, ByVal dwHandle as
Long, ByVal dwLen as
Long, lpData as
Any) as
Long
Declare Function GetVersion Lib "kernel32" () as
Long
Declare Function GetModuleHandle Lib "kernel32" alias
"GetModuleHandleA" (ByVal lpModuleName as
String) as
Long
Declare Function GetVersionEx Lib "kernel32" alias
"GetVersionExA" (LpVersionInformation as
OSVERSIONINFO) as
Long
Declare sub
GlobalMemoryStatus Lib "kernel32" (lpBuffer as
MEMORYSTATUS)
Declare sub
GetSystemInfo Lib "kernel32" (lpSystemInfo as
SYSTEM_INFO)
Public Const PROCESSOR_INTEL_386 = 386
Public Const PROCESSOR_INTEL_486 = 486
Public Const PROCESSOR_INTEL_PENTIUM = 586
Public Const PROCESSOR_MIPS_R4000 = 4000
Public Const PROCESSOR_ALPHA_21064 = 21064
Return