尝试调用GetImmersiveColorTypeFromName
以获取Windows 10通知区域的颜色。
但它总是返回-1
typedef int(WINAPI*pGetImmersiveColorTypeFromName)(char* name);
const pGetImmersiveColorTypeFromName GetImmersiveColorTypeFromName = (pGetImmersiveColorTypeFromName)GetProcAddress(hModule, (LPCSTR)96);
if (GetImmersiveColorTypeFromName)
{
colorType = GetImmersiveColorTypeFromName("ImmersiveApplicationTextDarkTheme");
}
我已经尝试了很多其他名字,但总是得到-1
答案 0 :(得分:3)
GetImmersiveColorTypeFromName
需要一个宽字符串,因此请将声明从char*
更改为wchar_t*
:
typedef int(WINAPI*pGetImmersiveColorTypeFromName)(wchar_t* name);
const pGetImmersiveColorTypeFromName GetImmersiveColorTypeFromName = (pGetImmersiveColorTypeFromName)GetProcAddress(hModule, (LPCSTR)96);
if (GetImmersiveColorTypeFromName)
{
colorType = GetImmersiveColorTypeFromName(L"ImmersiveApplicationTextDarkTheme");
}