Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21251

Get OS version: Not working!

$
0
0
For some reason both GetVersion and GetVersionEx think I'm running Windows XP, even though I'm running Windows 7.

VB Code:
  1. Public Function IsWinVistaPlus() As Boolean
  2.  
  3.   'returns True if running Windows Vista or later
  4.    Dim osv As OSVERSIONINFOEX
  5. DebugAppend "Detecting Windows Version..."
  6.    osv.OSVSize = Len(osv)
  7.  
  8.    If GetVersionEx(osv) = 1 Then
  9.         DebugAppend "osv.dwVerMajor=" & osv.dwVerMajor
  10.         DebugAppend "osv.dwVerMinor=" & osv.dwVerMinor
  11.  
  12.         DebugAppend "osv.PlatformID=" & osv.PlatformID
  13.         DebugAppend "osw.Build=" & osv.dwBuildNumber
  14.       IsWinVistaPlus = (osv.PlatformID = VER_PLATFORM_WIN32_NT) And _
  15.                    (osv.dwVerMajor >= 6)
  16.  
  17.    End If
  18.    
  19.    
  20. End Function
Debug output is 5/1/2/2600 for that code. I don't understand :confused:

Viewing all articles
Browse latest Browse all 21251

Trending Articles