简体   繁体   中英

Get Windows Version String C++

How can I get the windows version name in a string, eg "Windows 8.1, version 6.3.9600 - x64 (64 bit)" in C++, without using a library that is not included in windows. I have looked at getCurrentVersion and done countless searches for a solution, but have found nothing.

There's a detailed discussion of this on MSDN :

"To obtain the full version number for the operating system, call the GetFileVersionInfo function on one of the system DLLs, such as Kernel32.dll, then call VerQueryValue to obtain the \\\\StringFileInfo\\\\<lang><codepage>\\\\ProductVersion subblock of the file version information."

Perhaps you could obtain the information from the Win32_OperatingSystem class . I think the Description field might do what you want. For information on how to use WMI in C++ see Example: Getting WMI Data from the Local Computer .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM