指定Windows Version.Build [英] specifying Windows Version.Build

查看:93
本文介绍了指定Windows Version.Build的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,要找到正确的格式来告诉我的应用程序根据Windows构建在文本框中编写不同的内容

i have a problem with finding the correct form to tell my app to write a diferent thing in a text box according to windows build

代码是:

Private Sub Main_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load

Dim OSVer As Version = Environment.OSVersion.Version

    'Windows 10
    If OSVer.Build >= 10240 Then
        My.Forms.Main.WinVer.Text = "Detected Windows 10"
    End If

    'Windows 8 / 8.1
    If OSVer.Build <= 10000 And OSVer.Build >= 8000 Then
        My.Forms.Main.WinVer.Text = "Windows 8 / 8.1 are not supported yet"
    End If

    'Windows 7
    If OSVer.Build >= 7600 And OSVer.Build < 8000 Then
        My.Forms.Main.WinVer.Text = "Detected Windows 7"
    End If

    'OLD WINDOWS VERSION
    If OSVer.Build < 7600 Then
        My.Forms.Main.WinVer.Text = "Your Windows is not supported"
    End If
End Sub

我在Windows 10(内部版本10240)上,使用此代码后,应用程序向我显示了Windows 8 / 8.1情况的文本

i'm on windows 10 (build 10240), after using this code, the app showed me the text of Windows 8/8.1 situation

如何更正此错误?

推荐答案

根据此MSDN文章,您必须正确定位应用程序才能获得预期的效果结果。

According to this MSDN article, you have to target your application properly to get the expected results.

正确设置清单后,可以使用 OSVersion.Version.Major OSVersion.Version.Minor 属性来检查操作系统。在上面提到的文章中以表格形式指定了版本号。

After you setup the manifest properly, you can use the OSVersion.Version.Major and OSVersion.Version.Minor properties to check the operating system. The version numbers are specified in the above mentioned article in tabular form.

这篇关于指定Windows Version.Build的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆