0

When we log in from guest account in Windows 8 and try to find the version it give error and the same value as Windows 8. Please suggest some code OR API which will work for both windows 8 and Windows 8.1

user2771704
  • 5,994
  • 6
  • 37
  • 38

1 Answers1

0

This gives you some background knowledge: How can we check if the current OS is win8 or blue

And this is what works for me:

// this might only work as long as there's no successor to Windows 8.1
public Version GetVersion()
{
   var reportedVersion = System.Environment.OSVersion.Version;
   if (reportedVersion.Major==6 && reportedVersion.Minor==2)
   {
      bool _IsWindows8Point1OrGreater = Type.GetType("Windows.UI.Xaml.Controls.Flyout, Windows.UI.Xaml, ContentType=WindowsRuntime", false) != null;
      if(_IsWindows8Point1OrGreater )
      reportedVersion = new Version(6,3); 
   }
   return reportedVersion;
}
Community
  • 1
  • 1
HDW Production
  • 1,402
  • 10
  • 13
  • it will gives the result in true and false. I want the code which works for both windows 8 and 8.1 correctly. – Nikita Jain Oct 25 '13 at 05:02
  • So, how many different version do you expect when you tag your question with "Windows 8"??? ... I amended above post. – HDW Production Oct 25 '13 at 07:18
  • You should consider why you need to know whether it's *exactly* 8.0 or 8.1 rather than *at least* 8.0 or 8.1. – ta.speot.is Oct 25 '13 at 08:29
  • ta.speot.is: a good reason is that some apis behave differently when running on 8.1; even if the app is compiled for 8.0. – HDW Production Oct 25 '13 at 08:41
  • But if that behaviour is here to stay, then checking for 8.1 is silly because when 8.2 comes your code will fail. That's why you check *at least* 8.1 – ta.speot.is Oct 25 '13 at 08:54
  • Correct. Hence the comment above the code. If that behaviour is here to stay we'll have to add the next workaround as soon as 8.2 or 9.0 is released. ;-) – HDW Production Oct 25 '13 at 09:04