diff --git a/plugins/winsharedutils/theme.cpp b/plugins/winsharedutils/theme.cpp index d46825b9..90fd6a0a 100644 --- a/plugins/winsharedutils/theme.cpp +++ b/plugins/winsharedutils/theme.cpp @@ -152,16 +152,16 @@ DECLARE void _SetTheme( // return false; // } - // https://learn.microsoft.com/zh-cn/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type - // 设置背景 - static const DWM_SYSTEMBACKDROP_TYPE BACKDROP_MAP[] = { - DWMSBT_AUTO, DWMSBT_TRANSIENTWINDOW, DWMSBT_MAINWINDOW, DWMSBT_TABBEDWINDOW}; - DWM_SYSTEMBACKDROP_TYPE value = BACKDROP_MAP[(int)backdrop]; - + // 非常诡异,这里mar,BACKDROP_MAP,value的声明顺序会导致在win7-32位上崩溃,原因未知。 MARGINS mar{-1, -1, -1, -1}; // 这个最重要,不可以跳过,否则transaprent会黑。win7无效,仍然是黑的,所以win7不可以使用QTWIN11主题。 DwmExtendFrameIntoClientArea(_hWnd, &mar); + // https://learn.microsoft.com/zh-cn/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type + // 设置背景 + static const DWM_SYSTEMBACKDROP_TYPE BACKDROP_MAP[] = { + DWMSBT_AUTO, DWMSBT_TRANSIENTWINDOW, DWMSBT_MAINWINDOW, DWMSBT_TABBEDWINDOW}; + DWM_SYSTEMBACKDROP_TYPE value = BACKDROP_MAP[backdrop]; // 不管操作系统版本了,硬设置就行,测试不会崩溃,让系统自己处理。 DwmSetWindowAttribute(_hWnd, DWMWA_SYSTEMBACKDROP_TYPE, &value, sizeof(value)); }