|
-
Oct 21st, 2006, 03:50 PM
#1
Determine OS Version and Details (includes Vista support)
Last edited by RobDog888; Dec 30th, 2008 at 04:34 AM.
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 
-
Oct 22nd, 2006, 07:42 AM
#2
Re: Determine OS Version and Details (includes Vista support)
-
Dec 6th, 2006, 07:59 PM
#3
New Member
Re: Determine OS Version and Details (includes Vista support)
good work, now if only i'd looked on here at the start of te day i would have saved myself alot of searching and piecing together bits of other peoples code to find out all you have put
-
Dec 6th, 2006, 09:14 PM
#4
Re: Determine OS Version and Details (includes Vista support)
We all have days like that. 
Did you find anything additional that could be added to the code? Does it work correctly for you?
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 
-
Dec 7th, 2006, 02:54 AM
#5
New Member
Re: Determine OS Version and Details (includes Vista support)
possibly add the service pack level as well?? Ive not actually tried your code but it looks similar to mine.
-
Dec 7th, 2006, 04:02 AM
#6
Re: Determine OS Version and Details (includes Vista support)
Service pack info is in the strDetails variable along with the build version.
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 
-
Feb 12th, 2007, 04:55 PM
#7
Re: Determine OS Version and Details (includes Vista support)
Been looking for this for vb6
Does anyone have code like this for vb6
-
Feb 13th, 2007, 12:59 PM
#8
Re: Determine OS Version and Details (includes Vista support)
Its practically the same. Not too hard to convert it to VB 6.
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 
-
Feb 13th, 2007, 04:24 PM
#9
Re: Determine OS Version and Details (includes Vista support)
-
Apr 13th, 2007, 02:42 PM
#10
Lively Member
Re: Determine OS Version and Details (includes Vista support)
Here is a pretty basic program, all it requires is a form with four buttons, and it will work properly, this is the entire code, hope you like . By the way, the information is shown in a Messagebox.
VB Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'
'Returns Operating System Name, Platform and Version
'
MsgBox(" Operating System Name: " & My.Computer.Info.OSFullName & vbNewLine & " Operating System Platform: " & My.Computer.Info.OSPlatform.ToString & vbNewLine & " Operating System Version: " & My.Computer.Info.OSVersion.ToString, , )
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'
'Returns the total amount of Physical and Virtual Memory for the Computer.
'
MsgBox(" Total Physical Memory: " & My.Computer.Info.TotalPhysicalMemory.ToString & " bytes" & vbNewLine & " Total Virtual Memory: " & My.Computer.Info.TotalVirtualMemory.ToString & " bytes ")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'
'Get the displays current Resolution.
'
MsgBox(" Current Resolution: " & My.Computer.Screen.Bounds.Width.ToString & "x" & My.Computer.Screen.Bounds.Height.ToString & " Pixels")
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'
'Get the amount of Physical and Virtual Memory that is available.
'
MsgBox(" Available Physical Memory: " & My.Computer.Info.AvailablePhysicalMemory.ToString & " bytes" & vbNewLine & " Available Virtual Memory: " & My.Computer.Info.AvailableVirtualMemory.ToString & " bytes")
End Sub
End Class
There is a thin line between hobby, and obsession.
If you found my post helpful, please rate it.
My Laptop System Stats: nVidia 8800 graphics card, Two Intel Core Duo processors, 3.5 GB RAM, Windows Vista Ultimate, 15.4 Widescreen Brightview display, Built-in Webcam and Microphone.
My Alienware System Stats: nVidia 8800 graphics card, Intel Core Duo Extreme Edition processors, 4 gb RAM, Windows Vista Ultimate, 21 Inch Plasma Display, 42 Inch LCD HD display.
-
Aug 31st, 2007, 01:28 PM
#11
Re: Determine OS Version and Details (includes Vista support)
Yes, thats the easy way when you only need simple OS name or version. My code gets the suitemasks for a more detailed return.
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 20th, 2008, 02:42 PM
#12
Re: Determine OS Version and Details (includes Vista support)
To expand on this since MS has announced that Windows 7's internal version # is 6.2, here's the function that includes that:
Code:
Friend Function GetOSVersion() As String
Dim strVersion As String = "Unknown"
Select Case Environment.OSVersion.Platform
Case PlatformID.Win32S
strVersion = "Windows 3.1"
Case PlatformID.Win32Windows
Select Case Environment.OSVersion.Version.Minor
Case 0I
strVersion = "Windows 95"
Case 10I
If Environment.OSVersion.Version.Revision.ToString() = "2222A" Then
strVersion = "Windows 98 Second Edition"
Else
strVersion = "Windows 98"
End If
Case 90I
strVersion = "Windows ME"
End Select
Case PlatformID.Win32NT
Select Case Environment.OSVersion.Version.Major
Case 3I
strVersion = "Windows NT 3.51"
Case 4I
strVersion = "Windows NT 4.0"
Case 5I
Select Case Environment.OSVersion.Version.Minor
Case 0I
strVersion = "Windows 2000"
Case 1I
strVersion = "Windows XP"
Case 2I
strVersion = "Windows 2003"
End Select
Case 6I
Select Case Environment.OSVersion.Version.Minor
Case 0I
strVersion = "Windows Vista"
Case 1I
strVersion = "Windows 2008"
Case 2I
strVersion = "Windows 7"
End Select
End Select
Case PlatformID.WinCE
strVersion = "Windows CE"
Case PlatformID.Unix
strVersion = "Unix"
End Select
Return strVersion
End Function
Last edited by JuggaloBrotha; May 9th, 2009 at 06:32 AM.
-
Dec 22nd, 2008, 10:18 AM
#13
Re: Determine OS Version and Details (includes Vista support)
If you simply want the name and version, than the WMI class WIN32_Operating_System contains the full description as well 
(Including versions for Vista and Server)
I code C#....

-
Dec 30th, 2008, 03:05 AM
#14
Re: Determine OS Version and Details (includes Vista support)
Well my original code determines what flavor of Vista as well as other OS' which wont show in in the WMI classes. Just depends upon how much detail you need/want
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 
-
Dec 22nd, 2009, 04:35 PM
#15
Re: Determine OS Version and Details (includes Vista support)
EDIT:
Windows 7's internal version # is 6.2
Weird, cause my Windows 7 Ultimate's Internal number is 6.1
vb.net Code:
Case OSMajorVersion.VER_OS_VISTA_LONGHORN Select Case xosvi.dwMinorVersion Case 0 If xosvi.wProductType = WinPlatform.VER_NT_WORKSTATION Then If (xosvi.wSuiteMask And WinSuiteMask.VER_SUITE_PERSONAL) = WinSuiteMask.VER_SUITE_PERSONAL Then Return "Windows Vista (Home Premium, Home Basic, or Home Ultimate) Edition" Else Return "Windows Vista (Enterprize or Business)" & strDetails End If Else Return "Windows Server (Longhorn)" & strDetails End If Case 1 Return "Windows 7" End Select
This addon will do basic Windows 7 checking...and I mean basic
Last edited by formlesstree4; Dec 22nd, 2009 at 08:32 PM.
Reason: Readding all the crap I deleted
-
Dec 22nd, 2009, 08:33 PM
#16
Re: Determine OS Version and Details (includes Vista support)
Code:
If Environment.OSVersion.Platform = PlatformID.Win32NT AndAlso Environment.OSVersion.Version.Major = 6I AndAlso Environment.OSVersion.Version.Minor = 1I Then
'Running Win7 (any)
End If
-
Jan 6th, 2010, 01:28 PM
#17
Re: Determine OS Version and Details (includes Vista support)
 Originally Posted by JuggaloBrotha
Code:
If Environment.OSVersion.Platform = PlatformID.Win32NT AndAlso Environment.OSVersion.Version.Major = 6I AndAlso Environment.OSVersion.Version.Minor = 1I Then
'Running Win7 (any)
End If
That IF statement will not only return true for Windows 7 - it will return true for Server 2008 R2 as well as that has the same version number
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
|