Nov 5th, 2006, 09:05 PM
#1
Thread Starter
Lively Member
[RESOLVED] Get Windows Version
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 !!!!
Nov 5th, 2006, 09:15 PM
#2
Nov 5th, 2006, 09:56 PM
#3
Thread Starter
Lively Member
Re: Get Windows Version
thnax
my code is shorter than link "Windows Version, Service Pack and Platform Info"
Nov 5th, 2006, 10:04 PM
#4
Nov 5th, 2006, 10:34 PM
#5
Thread Starter
Lively Member
Re: Get Windows Version
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
Nov 6th, 2006, 12:49 AM
#6
Re: Get Windows Version
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.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Nov 6th, 2006, 12:53 AM
#7
Last edited by cssriraman; Nov 6th, 2006 at 07:10 AM .
CS
Nov 6th, 2006, 12:57 AM
#8
Re: Get Windows Version
My VB.NET code that could easily be converted back to legacy VB 6 code.
http://vbforums.com/showthread.php?t=434149
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Nov 6th, 2006, 07:33 AM
#9
Re: Get Windows Version
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.
Attached Files
Last edited by Keithuk; Nov 6th, 2006 at 07:36 AM .
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Nov 6th, 2006, 07:58 AM
#10
Re: Get Windows Version
How would you differentiate between OS Versions? For example, Windows XP Home and Professional.
Nov 6th, 2006, 12:35 PM
#11
Re: Get Windows Version
Its shown in my code example which can be used to update keiths example.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Nov 6th, 2006, 01:07 PM
#12
Re: Get Windows Version
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)
Nov 6th, 2006, 08:04 PM
#13
Thread Starter
Lively Member
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width