Even though I sent you the correct code, I'll post it here anyway, so other people can use it.
Copy this to a module:
Code:Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long Public Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 ' Maintenance string for PSS usage End Type Public g_udtOS As OSVERSIONINFO
Use this on any event you want:
Code:Dim lRet As Long g_udtOS.dwOSVersionInfoSize = Len(g_udtOS) lRet = GetVersionEx(g_udtOS) If lRet Then Text1.Text = g_udtOS.dwBuildNumber Else MsgBox "Error retrieving OS version." End If
Note: szCSDVersion element will show you Service Pack Number only in WindowsNT. For Windows95/98 it will return arbitrary additional information about the operating system.
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819




Reply With Quote