<legend id='CGbhc'><style id='CGbhc'><dir id='CGbhc'><q id='CGbhc'></q></dir></style></legend>

  • <i id='CGbhc'><tr id='CGbhc'><dt id='CGbhc'><q id='CGbhc'><span id='CGbhc'><b id='CGbhc'><form id='CGbhc'><ins id='CGbhc'></ins><ul id='CGbhc'></ul><sub id='CGbhc'></sub></form><legend id='CGbhc'></legend><bdo id='CGbhc'><pre id='CGbhc'><center id='CGbhc'></center></pre></bdo></b><th id='CGbhc'></th></span></q></dt></tr></i><div id='CGbhc'><tfoot id='CGbhc'></tfoot><dl id='CGbhc'><fieldset id='CGbhc'></fieldset></dl></div>

      <small id='CGbhc'></small><noframes id='CGbhc'>

        <bdo id='CGbhc'></bdo><ul id='CGbhc'></ul>
      <tfoot id='CGbhc'></tfoot>

      1. 如何检测我的应用程序是否在 Windows 10 上运行

        How can I detect if my app is running on Windows 10(如何检测我的应用程序是否在 Windows 10 上运行)
        <tfoot id='FrYKe'></tfoot>
          1. <i id='FrYKe'><tr id='FrYKe'><dt id='FrYKe'><q id='FrYKe'><span id='FrYKe'><b id='FrYKe'><form id='FrYKe'><ins id='FrYKe'></ins><ul id='FrYKe'></ul><sub id='FrYKe'></sub></form><legend id='FrYKe'></legend><bdo id='FrYKe'><pre id='FrYKe'><center id='FrYKe'></center></pre></bdo></b><th id='FrYKe'></th></span></q></dt></tr></i><div id='FrYKe'><tfoot id='FrYKe'></tfoot><dl id='FrYKe'><fieldset id='FrYKe'></fieldset></dl></div>
              <tbody id='FrYKe'></tbody>
              • <bdo id='FrYKe'></bdo><ul id='FrYKe'></ul>

                <small id='FrYKe'></small><noframes id='FrYKe'>

                <legend id='FrYKe'><style id='FrYKe'><dir id='FrYKe'><q id='FrYKe'></q></dir></style></legend>

                1. 本文介绍了如何检测我的应用程序是否在 Windows 10 上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在寻找一种方法来检测我的 C# 应用程序是否在 Windows 10 上运行.

                  我曾希望 Environment.OSVersion 能解决问题,但这似乎在 Windows 8.1 上返回 6.3.9600.0Version和 Windows 10.

                  如果它是 Windows 10,则使用此代码:

                   static bool IsWindows10(){var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWAREMicrosoftWindows NTCurrentVersion");string productName = (string)reg.GetValue("ProductName");return productName.StartsWith("Windows 10");}

                  注意:将 using Microsoft.Win32; 添加到您的使用中.

                  I'm looking for a means to detect if my C# app is running on Windows 10.

                  I had hoped that Environment.OSVersion would do the trick, but this seems to return a Version of 6.3.9600.0 on Windows 8.1 and Windows 10.

                  Other solutions such as this don't seem to distinguish between Windows 8 and Windows 10 either.

                  Any suggestions?


                  Why do I need to do this?

                  Because I'm using a WinForms WebBrowser control to host an OAuth page that crashes and burns in older IE versions (my app connects to a user's Nest account...).

                  By default, the WebBrowser control emulates IE7. Using a Registry key, you can tell it to emulate the latest version of IE that is installed on the host PC. However, the value that worked up to Windows 8.1 (and pre-releases of Windows 10) does not work in the final version of Windows 10.

                  解决方案

                  If you look at registry you will found environment name:

                  HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProductName
                  

                  For example my product name is Windows 10 Home:

                  With this code you get if it Windows 10:

                   static bool IsWindows10()
                   {
                       var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWAREMicrosoftWindows NTCurrentVersion");
                  
                       string productName = (string)reg.GetValue("ProductName");
                  
                       return productName.StartsWith("Windows 10");
                   }
                  

                  Note: Add using Microsoft.Win32; to your usings.

                  这篇关于如何检测我的应用程序是否在 Windows 10 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  IBM.Data.DB2.Core connection problems(IBM.Data.DB2.Core 连接问题)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  Datetime field overflow with IBM Data Server Client v9.7fp5(IBM Data Server Client v9.7fp5 的日期时间字段溢出)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)

                        1. <tfoot id='QgmG4'></tfoot>
                        2. <legend id='QgmG4'><style id='QgmG4'><dir id='QgmG4'><q id='QgmG4'></q></dir></style></legend>
                        3. <small id='QgmG4'></small><noframes id='QgmG4'>

                            <tbody id='QgmG4'></tbody>
                          <i id='QgmG4'><tr id='QgmG4'><dt id='QgmG4'><q id='QgmG4'><span id='QgmG4'><b id='QgmG4'><form id='QgmG4'><ins id='QgmG4'></ins><ul id='QgmG4'></ul><sub id='QgmG4'></sub></form><legend id='QgmG4'></legend><bdo id='QgmG4'><pre id='QgmG4'><center id='QgmG4'></center></pre></bdo></b><th id='QgmG4'></th></span></q></dt></tr></i><div id='QgmG4'><tfoot id='QgmG4'></tfoot><dl id='QgmG4'><fieldset id='QgmG4'></fieldset></dl></div>

                          • <bdo id='QgmG4'></bdo><ul id='QgmG4'></ul>