I'm checking the windows version in an installer (made with NSIS) by checking the following registry key:
HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
According to this post and this page from MSDN, the currentVersion number for Windows 10 should be 10.0.
I just installed the Windows 10 Pro Insider Preview and the version number given in the registry is still 6.3, instead of 10.10 as it should.
Is there another reliable way in registry to detect Windows 10?
Instead of reading the value CurrentVersion, read the new values CurrentMajorVersionNumber (which is 10) and CurrentMinorVersionNumber (which is 0) under Windows 10. Those 2 keys are new in Windows 10 to detect Windows Version from Registry.
There's also a human-readable string in the registry called "ProductName"
using Microsoft.Win32;
private string getOSInfo()
{
string registry_key = #"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
var key = Registry.LocalMachine.OpenSubKey(registry_key);
var value = key.GetValue("ProductName");
return value.ToString();
}
Try
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseId
Which gives me 10 and 1709.
See Peter Bright's article at https://arstechnica.com/information-technology/2014/11/why-windows-10-isnt-version-6-any-more-and-why-it-will-probably-work/ for more insight on why you see the answers you do. As you already saw from #magicandre1981, the CurrentMajorVersionNumber key will give you the "10" you want. You can get 10.0 from System.Environment.OSVersion if the application manifest explicitly designates your app for Windows 10, as stated in the referenced article. Without it, Environment.OSVersion will give you 6.2.9200, which is the same as Windows 8. So, your Windows 10 version is 10.0, 6.3, or 6.2, depending on how you ask the question.
Related
I'm checking the windows version in an installer (made with NSIS) by checking the following registry key:
HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
According to this post and this page from MSDN, the currentVersion number for Windows 10 should be 10.0.
I just installed the Windows 10 Pro Insider Preview and the version number given in the registry is still 6.3, instead of 10.10 as it should.
Is there another reliable way in registry to detect Windows 10?
Instead of reading the value CurrentVersion, read the new values CurrentMajorVersionNumber (which is 10) and CurrentMinorVersionNumber (which is 0) under Windows 10. Those 2 keys are new in Windows 10 to detect Windows Version from Registry.
There's also a human-readable string in the registry called "ProductName"
using Microsoft.Win32;
private string getOSInfo()
{
string registry_key = #"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
var key = Registry.LocalMachine.OpenSubKey(registry_key);
var value = key.GetValue("ProductName");
return value.ToString();
}
Try
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ReleaseId
Which gives me 10 and 1709.
See Peter Bright's article at https://arstechnica.com/information-technology/2014/11/why-windows-10-isnt-version-6-any-more-and-why-it-will-probably-work/ for more insight on why you see the answers you do. As you already saw from #magicandre1981, the CurrentMajorVersionNumber key will give you the "10" you want. You can get 10.0 from System.Environment.OSVersion if the application manifest explicitly designates your app for Windows 10, as stated in the referenced article. Without it, Environment.OSVersion will give you 6.2.9200, which is the same as Windows 8. So, your Windows 10 version is 10.0, 6.3, or 6.2, depending on how you ask the question.
I am using OSVERSIONINFO to check the OS in my vb6 application. But i am not able differentiate between windows 7 and windows server 2008 R2 because they have same version number,dwMajorVersion and dwMinorVersion. So how to differentiate between these. I think it can be done in vb.net using some other method. But how it can be done in vb6?
As Xearinox noted in the above comment, OSVERSIONINFOEX returns more information.
In particular, you can examine wProductType to determine whether VER_NT_WORKSTATION (0x0000001) is set or not. If it is, the machine is running a client OS, otherwise, server.
The chart in the remarks section of the OSVERSIONINFO MSDN entry even has a column which points out detecting the various OS's using that struct item.
Right Click On Tool Bar > Components And Add > Microsoft SysControl 6.0.
Double Click The SysInfo Button to Add on Form and use this code
Private Sub Form_Load()
Dim HancyRockz as string
HancyRockz = "OsVersion :- " & SysInfo1.OSVersion & " / Built " & SysInfo1.OSBuild
Text1.Text=HancyRockz
End Sub
I need to do tests on different versions of Internet Explorer browser, but not WATIN.CORE.IE a method that would alter the version of browser used. I hope you understand my problem.
You will need multiple virtual machines each installed with a different version of ie because you cannot install ie versions side by side (There are a few hacks but you never get a true representation).
You can query the registry to get the IE version.
To output the full version number to the NUnit console do the following.
var ieKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(#"SOFTWARE\Microsoft\Internet Explorer");
if (ieKey == null)
{
Console.WriteLine("IE key not found");
}
else
{
Console.WriteLine("Version:" + (string)ieKey.GetValue("Version"));
}
The above was verified using: Windows 7, IE8 and WatiN 2.0
Thanks be to Jeroen as the registry call is copied verbatim out of IE.cs
I'm trying to run expression "blend" on my laptop, but when i run project i get an error message with the following solution:
I don't know where I'm supposed to do this.
I got the answer from an expression blend help forum.
I solved the problem as follows.
Using regedit.exe I navigated to th registry path
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
and selected the key Platform. Platform had the value MCD.
Then I deleted only the value MCD. After this the key Platform was still there but empty. I closed Regedit, restarted my PC and run Blend 4.
is it possible to check if UAC is enabled with VB6 on win7 and vista?
i know it has to do with reading a value in the registry, i have see .net versions, but i need a vb6 sample code
thanks
DevX.com has an example of how to read the registry using VB6.
You'll have to add this constant: Const HKEY_LOCAL_MACHINE = &H80000002...it's missing from the sample.
You'll want to read the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System key's EnableLUA value. 1 == enabled.
There's also a decent example at freevbcode.com.