astrahhan
May 5th, 2001, 03:43 AM
How can I detect what OS the system is running(I care only for Windows 98, 2000, NT)?
Thanks
Thanks
|
Click to See Complete Forum and Search --> : Detect Windows astrahhan May 5th, 2001, 03:43 AM How can I detect what OS the system is running(I care only for Windows 98, 2000, NT)? Thanks coolbiz May 5th, 2001, 07:33 AM Try to play with this code (create new project and add this code into Form1): private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (byref lpVersionInformation as OSVERSIONINFO) as Long private 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 private Const VER_PLATFORM_WIN32_NT = 2 private Const VER_PLATFORM_WIN32_WINDOWS = 1 private Const VER_PLATFORM_WIN32s = 0 private sub Form_Load() dim sVer as OSVERSIONINFO ' version structure sVer.dwOSVersionInfoSize = len(sVer) ' size of structure ' get it if (GetVersionEx(sVer) = 0) then ' error - do error parsing if needed msgbox "error In Retrieving Version Info" else ' got it - parse the platform ID select case (sVer.dwPlatformId) case VER_PLATFORM_WIN32_NT: ' check for WinNT/2000 if (sVer.dwMajorVersion <= 4) then msgbox "Platform: WinNT" elseif (sVer.dwMajorVersion = 5) then msgbox "Platform: Win2000" else msgbox "Platform: Future Platform???" end if case VER_PLATFORM_WIN32_WINDOWS: ' check for win98/95 if ((sVer.dwMajorVersion > 4) or ((sVer.dwMajorVersion == 4) and (sVer.dwMinorVersion > 0))) then msgbox "Platform: Win98" else msgbox "Platform: Win95" end if case VER_PLATFORM_WIN32s: msgbox "Platform: Win32" end select end if end sub Have fun, -Cool Bizs codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |