I have to get the OSVersion
of my Windows8
System (version should be NT 6.2
) to use in a C++ application. I tried using GetVersion
function call. but it returned me a raw value like 602931718
. Is there some way by which I can get the versions as listed here or how can I convert this raw value to a readable form?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
I have compiled This programmer With Dev-C++ on Windows 7.The Programme is same as the Ist answer on This Question But On Dev-C++ The OSVERSIONINFOEX info requires typecasting when called in GetVersionEx().So Here Is The Code
Have you looked at GetVersionEx() function and OSVERSIONINFOEX structure?
Possible usage:
I don't understand, what do you mean by
NT
. According to MSDN:Since Windows XP, all versions are implicitly
NT
versions. If you want to test against Server versions, check value ofinfo.wProductType
:And one more thing: you can also check value of
info.dwBuildNumber
. One of allowed values isVER_PLATFORM_WIN32_NT
.If you want to make it more convenient, you could try converting to a float instead of checking two integers:
Regarding last term added to create float version, specifically, "using VER_NT_WORKSTATION", I had some debate about if the server version should be +0.05 or -0.05, or the same as non-server version. I'll leave that one up to you to decide.
Note that functions GetVersion and GetVersionEx have been deprecated. This is also reflected in what their doc. pages say (this one copied from GetVersion):
"With the release of Windows 8.1, the behavior of the GetVersion API has changed in the value it will return for the operating system version. The value returned by the GetVersion function now depends on how the application is manifested."