如何以编程方式告诉XP 64位和Server 2003 64位的区别 [英] How to programmatically tell the difference between XP 64 bit and Server 2003 64 Bit

查看:144
本文介绍了如何以编程方式告诉XP 64位和Server 2003 64位的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,我需要显示不同的链接到一个不同的下载基于用户正在运行的Windows版本。

I have a program where I need to display a different link to a different download based on what version of windows a user is running.

使用这个答案我能够检测哪个版本的操作系统是。同时使用这个答案我可以检测,如果我在32位或64位版本的操作系统上运行。

Using this answer I am able to detect which version the OS is. Also using this answer I can detect if I am running on a 32 bit or 64 bit version of the OS.

这会适合我的需要完美,但我碰到的这个页面其中指出,无论 Windows XP的64位版本的Windows Server 2003 使用版本号 5.2

This would suit my needs perfectly, however I came across this page which states that both Windows XP 64-Bit Edition and Windows Server 2003 use the version number 5.2.

如何检测这两个操作系统的区别呢?

How do I detect the difference between those two OS's?

作为一个方面说明,我确实需要把它们发送到不同的位置,如果他们是在2003年的64位或XP 64位,这里有我需要的链接派人到:

As a side note, I do need to send them to a different location if they are on 2003 64 bit or on XP 64 bit, here are the links I am needing to send people to:

  • Remote Desktop Connection (Terminal Services Client 6.1) for Windows XP
  • Remote Desktop Connection (Terminal Services Client 6.0) for Windows XP x64 Edition
  • Remote Desktop Connection (Terminal Services Client 6.0) for Windows Server 2003
  • Remote Desktop Connection (Terminal Services Client 6.0) for Windows Server 2003 x64 Edition

推荐答案

GetVersionEx 将设置 wProductType VER_NT_SERVER 的Windows Server 2003/2008 / 2008R2 / 2012,与 VER_NT_WORKSTATION 适用于Windows XP / 7/8。

GetVersionEx will set wProductType to VER_NT_SERVER for Windows Server 2003/2008/2008R2/2012, versus VER_NT_WORKSTATION for Windows XP/7/8.

您已经知道如何让操作系统是32位或64位,所以有位P / Invoke的的(GetVersionEx是的此处),你应该能够找出休息。

You already know how to get whether the OS is 32-bit or 64-bit, so with a bit of P/Invoke (GetVersionEx is here), you should be able to figure out the rest.

另外,如果你不想使用的P / Invoke,你的可以的使用WMI,并采取一看的Win32_OperatingSystem 类,其中有在 ProductType 属性相同的信息。我不会理会做这种方式,除非你真的的的到。

Alternatively, if you don't want to use P/Invoke, you could use WMI, and take a look at the Win32_OperatingSystem class, which has the same information in the ProductType property. I wouldn't bother doing it this way unless you really had to.

这篇关于如何以编程方式告诉XP 64位和Server 2003 64位的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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