Is there a way to get the version of the windows in few lines?!
because i have to write a lot and alot of codes to get it !!!!
Printable View
Is there a way to get the version of the windows in few lines?!
because i have to write a lot and alot of codes to get it !!!!
Not in few lines though...
Windows Version, Service Pack and Platform Info
thnax
my code is shorter than link "Windows Version, Service Pack and Platform Info"
But is it as good?
I think so
i use this code , if there a comment plz post it
VB Code:
Public Type OSVERSIONINFOEX 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 OSVERSIONINFOEX) As Long Public Function OSVersion() As String Dim udtOSVersion As OSVERSIONINFOEX Dim lMajorVersion As Long Dim lMinorVersion As Long Dim lPlatformID As Long Dim sAns As String udtOSVersion.dwOSVersionInfoSize = Len(udtOSVersion) GetVersionEx udtOSVersion lMajorVersion = udtOSVersion.dwMajorVersion lMinorVersion = udtOSVersion.dwMinorVersion lPlatformID = udtOSVersion.dwPlatformId Select Case lMajorVersion Case 5 sAns = "Windows XP" Case 4 If lPlatformID = VER_PLATFORM_WIN32_NT Then sAns = "Windows NT 4.0" Else sAns = IIf(lMinorVersion = 0, _ "Windows 98", "Windows ME") End If Case 3 If lPlatformID = VER_PLATFORM_WIN32_NT Then sAns = "Windows NT 3.x" Else sAns = "Windows 3.x" End If Case Else sAns = "Unknown Windows Version" End Select OSVersion = sAns End Function
form code
VB Code:
Text1.Text=OSVersion
It doesnt differenciate between 95/98,ME. Also, no Server OS' detection, Vista and Vista versions, XP and XP version, any revisions and or service packs etc. :)
Checkout the link:
How to find/display Windows OS Version
My VB.NET code that could easily be converted back to legacy VB 6 code.
http://vbforums.com/showthread.php?t=434149
This About Form with OSInfo.cls will show all versions of Windows accept XP. Mine shows the difference between Win98 and Win98se. If you want to modify it to show WinXP great just mod it and post it back. ;)
How would you differentiate between OS Versions? For example, Windows XP Home and Professional.
Its shown in my code example which can be used to update keiths example.
Link to a sample I posted contains link to more complete sample so if anyone bothered to look it up then you would certainly come across sample below:
Windows Version Info (Wrapper Routines)
Thanks for you all