系统的托盘区域时钟视觉主题是 documented在 MSDN 中,所以我想微软希望我们能够使用它。我想用它来绘制任务栏带的背景,以便与托盘区域更好地融合。当我尝试
OpenThemeData(NULL, L"CLOCK");
它总是失败。我发现获得该主题的唯一方法是找到实际的时钟窗口,并请求其主题:
使用
FindWindowEx
定位具有Shell_TrayWnd
类的窗口,然后使用TrayNotifyWnd
类定位其子窗口,然后使用该窗口的子窗口TrayClockWClass
类。调用 OpenThemeData 并传递实际时钟的窗口句柄。
显然,内部 Windows 窗口类名称没有记录。虽然上面的方法似乎可行,但我宁愿使用不太脆弱的方法。
问题:是否有任何明智的方法来获取托盘区域的时钟视觉主题?
最佳答案
显然你不能总是使用带有 NULL 的 OpenThemeData
http://microsoft.public.platformsdk.shell.narkive.com/gkVTBGA2/cannot-open-theme-data-for-tray-notification-area
Jim Barry 6 years ago
You need to have an HWND that you can call SetWindowTheme for. Set pszSubAppName to "TrayNotifyHoriz" or "TrayNotifyVert" and leave pszSubIdList as NULL. You can then call OpenThemeData with pszClassList set to "TrayNotify".
How anyone is supposed to figure this stuff out is totally beyond me. The visual styles documentation is quite frankly abysmal, an absolute disgrace.
-- Jim Barry, MVP (Windows SDK)
关于winapi - 获得托盘区域时钟视觉主题的最佳方式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12029043/