1 #pragma once 2 3 struct WinVersion 4 { 5 public: 6 WinVersion(); 7 8 int m_major_version; 9 int m_minor_version; 10 int m_build_number; 11 }; 12 13 class CWinVersionHelper 14 { 15 public: 16 ~CWinVersionHelper(); 17 18 static bool IsWindows11OrLater(); //判断当前Windows版本是否为Win11或更新的版本 19 static bool IsWindows10(); //判断Windows版本是否为Windows10 20 static bool IsWindows10FallCreatorOrLater(); //判断当前Windows版本是否为Win10秋季创意者更新或更新的版本 21 static bool IsWindowsVista(); 22 static bool IsWindows7(); //判断Windows版本是否为Windows7 23 static bool IsWindows7OrLater(); 24 static bool IsWindows8Or8point1(); //判断Windows版本是否为Windows8或Windows8.1 25 static bool IsWindows8OrLater(); 26 static bool IsWindows81OrLater(); 27 static bool IsWindows10OrLater(); 28 static bool IsWindows10Version1809OrLater(); 29 GetMajorVersion()30 static int GetMajorVersion() { return m_version.m_major_version; } GetMinorVersion()31 static int GetMinorVersion() { return m_version.m_minor_version; } GetBuildNumber()32 static int GetBuildNumber() { return m_version.m_build_number; } 33 34 static bool IsWindows10LightTheme(); 35 static void CheckWindows10LightTheme(); 36 37 private: 38 CWinVersionHelper(); 39 static LONG GetDWORDRegKeyData(HKEY hKey, const wstring& strValueName, DWORD& dwValueData); 40 41 static WinVersion m_version; 42 static bool m_windows10_light_theme; 43 }; 44