windows - 如何在桌面应用程序中检测 Windows 8.1

标签 windows winapi

在 Windows 8.1 预览版中,Environment.OSVersion.Version 返回与 Windows 8 相同的版本号。是否有检测 Windows 8.1 的替代方法。

最佳答案

看看这篇文章:

Operating system version changes in Windows 8.1 Preview

GetVersion(Ex) APIs have been deprecated. That means that while you can still call the APIs, if your app does not specifically target Windows 8.1 Preview, you will get Windows 8 versioning (6.2.0.0).

它说的是 GetVersion 对你说谎关于真正的操作系统版本,除非你在你的 list 中明确指示 8.1。

您需要将以下内容添加到应用程序 list 中:

 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    <application> 
      * <!-- Windows 8.1 -->
      * <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
        <!-- Windows Vista -->
        <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
        <!-- Windows 7 -->
        <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
        <!-- Windows 8 -->
        <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    </application> 
</compatibility>

如果您不想这样做,您可以检查以下注册表项:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

当前版本将为您提供 6.3

当前版本号为 9431

关于windows - 如何在桌面应用程序中检测 Windows 8.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17399302/

相关文章:

windows - Windows 上的 Perl : Problems with Encoding

windows - Jenkins Pipeline 无法在 Windows slave 中执行 SH 命令文件

c++ - 如何将目录符号链接(symbolic link)复制为指向目标的链接?

c# - 向 Windows 服务发送 Windows 消息

perl - 我使用什么 Perl 模块从 Windows 上的相对路径获取绝对路径(包括文件名)?

c++ - 如何获取所有系统进程的GuiResources?

windows - 批处理文件暂停需要两次按键才能关闭

c - 当我使用内核调试器在 Windows 64 位上的 SYSCALL 的 IA32_LSTAR MSR 上设置断点时,为什么会出现 DoubleFault? (KVASCODE 部分)

c - WinAPI 写文件

c++ - 通过 C++ 控制应用程序的监视器