VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

fGetSystemInfo

Brian Cidern  (4 Submissions)   Windows API Call/Explanation   Visual Basic 3.0   Advanced   Wed 3rd February 2021

MS stipulates that OS Version Info must be obtained "correctly" in their Windows2000 Application Specifications. This is the way.
It also uses api's to get the OS path, get the Windows Temp Dir and to generate a unique temp file name.
This is a .BAS file with a Sub Main() so it should compile easily. It generates the info, writes to a temp file and launches notepad with the info. No forms. You can easily hash through it to pull out what you need.

Inputs
None--

Assumes
Just copy the entire source to a .bas file and launch. No forms needed. step through to pull out what you want.

Returns
None--

Side Effects
Compiled under VB5/6 and ran on WinNT4 (server) and Windows2000 Professional. Don't know about the 9.x kernel, but it should be fine.

API Declarations
' used for dwPlatformId
Const VER_PLATFORM_WIN32s = 0
Const VER_PLATFORM_WIN32_WINDOWS = 1
Const VER_PLATFORM_WIN32_NT = 2
' used for wSuiteMask
Const VER_SUITE_BACKOFFICE = 4
Const VER_SUITE_DATACENTER = 128
Const VER_SUITE_ENTERPRISE = 2
Const VER_SUITE_SMALLBUSINESS = 1
Const VER_SUITE_SMALLBUSINESS_RESTRICTED = 32
Const VER_SUITE_TERMINAL = 16
' used for wProductType
Const VER_NT_WORKSTATION = 1
Const VER_NT_DOMAIN_CONTROLLER = 2
Const VER_NT_SERVER = 3
Const MAX_PATH = 260
Private Type OSVERSIONINFOEX
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
wServicePackMajor As Integer
wServicePackMinor As Integer
wSuiteMask As Integer
wProductType As Byte
wReserved As Byte
End Type

Private Declare Function GetVersionEx _
Lib "kernel32" _
Alias "GetVersionExA" ( _
lpVersionInformation As OSVERSIONINFOEX _
) As Long
Private Declare Function GetWindowsDirectory _
Lib "kernel32" _
Alias "GetWindowsDirectoryA" ( _
ByVal lpBuffer As String, _
ByVal nSize As Long _
) As Long
Private Declare Function GetTempPath _
Lib "kernel32" _
Alias "GetTempPathA" ( _
ByVal nBufferLength As Long, _
ByVal lpBuffer As String _
) As Long
Private Declare Function GetTempFileName _
Lib "kernel32" _
Alias "GetTempFileNameA" ( _
ByVal lpszPath As String, _
ByVal lpPrefixString As String, _
ByVal wUnique As Long, _
ByVal lpTempFileName As String _
) As Long
Dim sSystemInfo As String
Dim OSVI As OSVERSIONINFOEX

Rate fGetSystemInfo (3(3 Vote))
fGetSystemInfo.bas

fGetSystemInfo Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters