Wicked! Here is a single API call impl
. . . or wrapped in a propertyCode:Dim aBuffer(0 To 4) As Long Call CopyMemory(aBuffer(0), ByVal &H7FFE0260, 20) Debug.Print aBuffer(3) & "." & aBuffer(4) & "." & aBuffer(0)
cheers,Code:Option Explicit Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Private Enum UcsOsVersionEnum ucsOsvNt4 = 400 ucsOsvWin98 = 410 ucsOsvWin2000 = 500 ucsOsvXp = 501 ucsOsvVista = 600 ucsOsvWin7 = 601 ucsOsvWin8 = 602 [ucsOsvWin8.1] = 603 ucsOsvWin10 = 1000 End Enum Private Sub Form_Load() Dim lBuildNo As Long Debug.Print RealOsVersion(lBuildNo), lBuildNo End Sub Private Property Get RealOsVersion(Optional BuildNo As Long) As UcsOsVersionEnum Dim aBuffer(0 To 4) As Long Call CopyMemory(aBuffer(0), ByVal &H7FFE0260, 20) BuildNo = aBuffer(0) RealOsVersion = aBuffer(3) * 100 + aBuffer(4) End Property
</wqw>




Reply With Quote