Get Windows theme?

后端 未结 2 876
灰色年华
灰色年华 2020-12-10 19:06

I must really know which Windows theme my user is using.
More precisely, Classic, XP, Basic or Aero. (Basic theme as in Vista/7 Windows Basic theme)
I already know h

2条回答
  •  星月不相逢
    2020-12-10 19:52

    You can check the registry for the current theme at:

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes

    under String "CurrentTheme" which has the path to the current theme. below is the code for checking it in C#.

    using Microsoft.Win32;
    
    public string GetTheme()
    {
      string RegistryKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes";
      string theme;
      theme = (string) Registry.GetValue(RegistryKey, "CurrentTheme", string.Empty);
      theme = theme.Split('\\').Last().Split('.').First().ToString();
      return theme;
    }
    

提交回复
热议问题