windows C++ 检测操作系统版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4207466/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C++ Detect OS Version
提问by sikas
I want to know how to detect the running OS using the C++ and which service pack installed
我想知道如何使用 C++ 检测正在运行的操作系统以及安装的服务包
回答by Ryan Reeves
I assume you're writing unmanaged C++ using Win32? Look into the Win32 API GetVersionEx
.
我假设您正在使用 Win32 编写非托管 C++?查看 Win32 API GetVersionEx
。
回答by Daniel Daranas
For Windows, see this example called GetOSDisplayStringfrom MSDN, in which the use of GetVersionExis demonstrated.
对于 Windows,请参阅MSDN 中名为GetOSDisplayString 的示例,其中演示了GetVersionEx的使用。
回答by Brian Walker
Assuming this is for Windows - use GetVersionEx
假设这是用于 Windows - 使用 GetVersionEx
回答by Chris
Maybe this can be helpful: http://msdn.microsoft.com/en-us/library/ak37a69s%28v=VS.90%29.aspx
也许这会有所帮助:http: //msdn.microsoft.com/en-us/library/ak37a69s%28v=VS.90%29.aspx