forked from maximmenshikov/common
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTheme.hpp
More file actions
29 lines (27 loc) · 799 Bytes
/
Copy pathTheme.hpp
File metadata and controls
29 lines (27 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
namespace Shell
{
class Theme
{
public:
static DWORD GetAccentColor()
{
DWORD dwTempColor = 0;
wchar_t accentNum[50], themeNum[50];
if (RegistryGetString(HKEY_LOCAL_MACHINE, L"ControlPanel\\Themes", L"CurrentAccent", accentNum, 50) == S_OK)
{
if (RegistryGetString(HKEY_LOCAL_MACHINE, L"ControlPanel\\Themes", L"CurrentTheme", themeNum, 50) == S_OK)
{
wchar_t regKey[500];
swprintf(regKey, L"ControlPanel\\Themes\\%ls\\Accents", themeNum);
if (RegistryGetDWORD(HKEY_LOCAL_MACHINE, regKey, accentNum, &dwTempColor) == S_OK)
{
dwTempColor = dwTempColor & 0xFFFFFF;
dwTempColor = ((dwTempColor >> 16) & 0xFF) | (((dwTempColor >> 8) & 0xFF) << 8) | ((dwTempColor & 0xFF) << 16);
}
}
}
return dwTempColor;
}
};
}