Question:
Is it possible to use API to determine the OS of a system without resorting to SysInfo control?
Answer:
Sure. Just call the GetVersionEx API. Add the following to your Declarations section:
Private Declare Function GetVersionEx Lib "kernel32" _ Alias "GetVersionExA" (lpVersionInformation _ As OSVERSIONINFO) As LongPrivate Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128End TypePrivate Const VER_PLATFORM_WIN32s = 0Private Const VER_PLATFORM_WIN32_WINDOWS = 1Private Const VER_PLATFORM_WIN32_NT = 2
Then, to make the call, declare an instance of the OSVERSIONINFO type, fill out its length member, and pass it to GetWindowEx:
Dim os As OSVERSIONINFO os.dwOSVersionInfoSize = Len(os) Call GetVersionEx(os)