Как определить версию операционной системы
(Win95/Win98/NT)
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 Const VER_PLATFORM_WIN32s = 0
Public Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Const VER_PLATFORM_WIN32_NT = 2
Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Public Function IsWindowsNT() As Boolean
Dim osvi As OSVERSIONINFO
osvi.dwOSVersionInfoSize = Len(osvi)
GetVersionEx osvi
IsWindowsNT = (osvi.dwPlatformId = VER_PLATFORM_WIN32_NT)
End Function
Public Function IsWindows98() As Boolean
Dim osvi As OSVERSIONINFO
osvi.dwOSVersionInfoSize = Len(osvi)
GetVersionEx osvi
IsWindows98 = (osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS And osvi.dwMinorVersion >= 10 And osvi.dwMajorVersion = 4)
End Function
Использование:
bWindowsNT = IsWindowsNT() ' True, если установлена NT
bWindows98 = IsWindows98() ' True, если установлена Windows98
|