常见问题 Microsoft/微软办公软件的常见问题>>

如何检查我是否正在运行某个版本的Windows 7 E?

发布时间:2010-10-29 10:06:40

答案:

GetProductInfo() API(已包含在Vista中)可以精确地告诉你当前Windows版本。用于Windows 7 E的新的常量值会在Windows 7 SDK中提供。

家庭高级版与旗舰版识别代码示例:

[DllImport("Kernel32.dll")]
        internal static extern bool GetProductInfo(
            int osMajorVersion,
            int osMinorVersion,
            int spMajorVersion,
            int spMinorVersion,
            out uint edition);
                private void CheckEdition()
        {
            uint edition;
            GetProductInfo(6, 1, 0, 0, out edition);
            switch ((ProductEditions)(edition))
            {
                case ProductEditions.HOMEPREMIUM :
                case ProductEditions.HOMEPREMIUME:
                case ProductEditions.HOMEPREMIUMN:
                    MessageBox.Show("Running on a Home Premium edition");
                    break;
                case ProductEditions.ULTIMATE :
                case ProductEditions.ULTIMATEE:
                case ProductEditions.ULTIMATEN:
                    MessageBox.Show("Running on an Ultimate edition");
                    break;

下一步您可以:
查看Microsoft/微软办公软件产品 >>
查看办公软件产品 >>
查看Microsoft/微软办公软件常见问题 >>