I found the answer and posted in StackOverflow.com
How To Use the SHGetKnownFolderPath Function from Vb6
My answer was derived from http://en.kioskea.net/faq/951-vba-vb6-my-documents-environment-variables.
Collection of unedited thoughts and bits of knowledge I can't seem to remember
Search This Blog
Showing posts with label Stupid WIN32 API Tricks. Show all posts
Showing posts with label Stupid WIN32 API Tricks. Show all posts
Monday, April 11, 2011
Determine Windows version via WIN32 API in VB6
'Get Windows Version
Public Declare Function GetVersionExA Lib "kernel32" _
(lpVersionInformation As OSVERSIONINFO) As Integer
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Public Function IsVistaOrHigher() As Boolean
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
Dim bVista As Boolean
bVista = False
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
If osinfo.dwPlatformId = 2 Then
If osinfo.dwMajorVersion = 6 Then
bVista = True
End If
End If
IsVistaOrHigher = bVista
End Function
Public Declare Function GetVersionExA Lib "kernel32" _
(lpVersionInformation As OSVERSIONINFO) As Integer
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Public Function IsVistaOrHigher() As Boolean
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
Dim bVista As Boolean
bVista = False
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
If osinfo.dwPlatformId = 2 Then
If osinfo.dwMajorVersion = 6 Then
bVista = True
End If
End If
IsVistaOrHigher = bVista
End Function
Subscribe to:
Comments (Atom)