Determining host operating system using VB 6
Posted: Wed 09 Jun 2010, 09:09
Hi all,
I am sharing this topic with you.Hope u all find this very interesting.
Any suggestions are appreciated.
The first step is to make some simple declarations. Add the following code to your projects declarations.
Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT As Long = 2
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As Any) As Long
Private Type OSVERSIONINFO
OSVSize As Long
dwVerMajor As Long
dwVerMinor As Long
dwBuildNumber As Long
PlatformID As Long
szCSDVersion As String * 128
End Type
After we are done with the above declaration we can have some methods/functions to determine current OS as shown below.
# 1.
Public Function IdentifyOperatingSystem() As String
Dim rOsVersionInfo As OSVERSIONINFO
Dim sOperatingSystem As String
sOperatingSystem = "NONE"
rOsVersionInfo.OSVSize = Len(rOsVersionInfo)
If GetVersionEx(rOsVersionInfo) Then
Select Case rOsVersionInfo.PlatformID
http://www.mindfiresolutions.com/Determ ... -6-189.php
I am sharing this topic with you.Hope u all find this very interesting.
Any suggestions are appreciated.
The first step is to make some simple declarations. Add the following code to your projects declarations.
Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT As Long = 2
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As Any) As Long
Private Type OSVERSIONINFO
OSVSize As Long
dwVerMajor As Long
dwVerMinor As Long
dwBuildNumber As Long
PlatformID As Long
szCSDVersion As String * 128
End Type
After we are done with the above declaration we can have some methods/functions to determine current OS as shown below.
# 1.
Public Function IdentifyOperatingSystem() As String
Dim rOsVersionInfo As OSVERSIONINFO
Dim sOperatingSystem As String
sOperatingSystem = "NONE"
rOsVersionInfo.OSVSize = Len(rOsVersionInfo)
If GetVersionEx(rOsVersionInfo) Then
Select Case rOsVersionInfo.PlatformID
http://www.mindfiresolutions.com/Determ ... -6-189.php