|
-
Jan 1st, 2008, 10:41 AM
#1
Thread Starter
Addicted Member
[2008] WinXP and Vista
I didnt use Win Vista yet so I dont know if the coding for WinXP would work for Win Vista.
I have few questions:
1)Is there a code to find out what windows is the user using? (XP or Vista)
2)Is Registry the same? Can a program that work with WinXP work with Win Vista's Registry without any additional codes (something to get privialge maybe?)
3)what else should we care about if we're making a program to run on both WinXP and WinVista?
thanks for your help
-
Jan 1st, 2008, 11:01 AM
#2
Re: [2008] WinXP and Vista
heres an example for getting OS version.
i'm not sure how to get OS if vista, but it'll be similar to the other OS's
vb Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox(OS_Version)
End Sub
Public Function OS_Version() As String
Dim osInfo As OperatingSystem
Dim sAns As String = ""
osInfo = System.Environment.OSVersion
With osInfo
Select Case .Platform
Case 1 '.Platform.Win32Windows
Select Case (.Version.Minor)
Case 0
sAns = "Windows 95"
Case 10
If .Version.Revision.ToString() = "2222A" Then
sAns = "Windows 98 Second Edition"
Else
sAns = "Windows 98"
End If
Case 90
sAns = "Windows Me"
End Select
Case 2 '.Platform.Win32NT
Select Case (.Version.Major)
Case 3
sAns = "Windows NT 3.51"
Case 4
sAns = "Windows NT 4.0"
Case 5
If .Version.Minor = 0 Then
sAns = "Windows 2000"
ElseIf .Version.Minor = 1 Then
sAns = "Windows XP"
ElseIf .Version.Minor = 2 Then
sAns = "Windows Server 2003"
Else 'Future version maybe update
'as needed
sAns = "Unknown Windows Version"
End If
End Select
End Select
End With
Return sAns
End Function
End Class
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jan 1st, 2008, 01:25 PM
#3
Re: [2008] WinXP and Vista
The posted code wont detect Vista. Here is the additional code with changes to work with Option Strict On
VB.NET Code:
Option Explicit On
Option Strict On
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MessageBox.Show(OS_Version, "Operating System Version", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Public Function OS_Version() As String
Dim osInfo As OperatingSystem
Dim sAns As String = ""
osInfo = System.Environment.OSVersion
With osInfo
Select Case DirectCast(.Platform, Integer)
Case 1 '.Platform.Win32Windows
Select Case (.Version.Minor)
Case 0
sAns = "Windows 95"
Case 10
If .Version.Revision.ToString() = "2222A" Then
sAns = "Windows 98 Second Edition"
Else
sAns = "Windows 98"
End If
Case 90
sAns = "Windows Me"
End Select
Case 2 '.Platform.Win32NT
Select Case (.Version.Major)
Case 3
sAns = "Windows NT 3.51"
Case 4
sAns = "Windows NT 4.0"
Case 5
If .Version.Minor = 0 Then
sAns = "Windows 2000"
ElseIf .Version.Minor = 1 Then
sAns = "Windows XP"
ElseIf .Version.Minor = 2 Then
sAns = "Windows Server 2003"
Else 'Future version maybe update
'as needed
sAns = "Unknown Windows Version"
End If
Case 6
sAns = "Windows Vista" & " " & .ServicePack
'Or you can return the actual version
'sAns = .VersionString & " " & .ServicePack
End Select
End Select
End With
Return sAns
End Function
End Class
Second, yes there are major changes with the registry. No longer can you simply access the registry. The User Account Control popup will control it if the user has Administrator permissions or can get an Administrator to fill in the logon prompt for elevating the process to Administrator so the process can read the registry.
Also, there are more protected directories. No longer can you store shared data in the Application.StartupDirectory.
Basically, anything that does work on XP will probably fail on Vista unless you code accordingly for the new security and directory changes..
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 
-
Jan 2nd, 2008, 04:36 AM
#4
Frenzied Member
Re: [2008] WinXP and Vista
I hade a similar question regarding the My Music folder in xp as vista now calls it just Music.
But as usual the legend helped me out.
This will find the default Music folder on xp or vista
 Originally Posted by jmcilhinney
Wouldn't
vb.net Code:
Environment.GetFolderPath(Environment.SpecialFolder.MyMusic)
just return the correct folder path for the current OS?
-
Jan 2nd, 2008, 12:22 PM
#5
Re: [2008] WinXP and Vista
Um is this the right thread you are replying to? Ths thread is about detecting the OS 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 
-
Jan 2nd, 2008, 03:56 PM
#6
Re: [2008] WinXP and Vista
 Originally Posted by RobDog888
Um is this the right thread you are replying to? Ths thread is about detecting the OS version. 
I think toecutter was answering peritos 3rd question
-
Jan 2nd, 2008, 05:38 PM
#7
Re: [2008] WinXP and Vista
Oh well um its still called "Music" which isnt really that different from "My Music". Then the constant is the same value still so programmatically accessing it is done not by name but by constant value.
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 
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
|