From 76b0d3a6651d3f4c1feceb566b0c02854ab14810 Mon Sep 17 00:00:00 2001 From: aubymori Date: Fri, 20 Oct 2023 19:47:44 -0500 Subject: [PATCH] Classic Conhost: SetThemeAppProperties(STAP_ALLOW_NONCLIENT) if classic This will replicate XP behavior for properties window --- mods/classic-conhost.wh.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/mods/classic-conhost.wh.cpp b/mods/classic-conhost.wh.cpp index 8980ad8ba..faa577bbb 100644 --- a/mods/classic-conhost.wh.cpp +++ b/mods/classic-conhost.wh.cpp @@ -1,33 +1,17 @@ // ==WindhawkMod== // @id classic-conhost // @name Classic Conhost -// @description Forces classic theme and optionally client edge on console windows +// @description Forces classic theme and/or client edge on console windows // @version 1.0.0 // @include * // @compilerOptions -luser32 -ldwmapi -luxtheme // ==/WindhawkMod== -// ==WindhawkModReadme== -/* -# Classic Conhost - -This mod will apply classic theme and optionally client edge to console windows. - -**Before**: - -![Before](https://raw.githubusercontent.com/aubymori/images/main/classic-conhost-before.png) - -**After**: - -![After](https://raw.githubusercontent.com/aubymori/images/main/classic-conhost-after.png) -*/ -// ==/WindhawkModReadme== - // ==WindhawkModSettings== /* - classic: true $name: Classic theme - $description: Apply classic theme to console windows. Disable this if you use classic theme system-wide. + $description: Apply classic theme to console windows - clientedge: true $name: Client edge (Classic theme only) $description: Apply a client edge to console windows @@ -123,6 +107,20 @@ BOOL Wh_ModInit(void) { LoadSettings(); + if (settings.classic) + { + WCHAR szPath[MAX_PATH], *pBackslash = NULL; + if (GetModuleFileNameW(NULL, szPath, MAX_PATH)) + { + LPWSTR szPathL = wcslwr(szPath); + pBackslash = wcsrchr(szPathL, L'\\'); + if (pBackslash && !wcscmp(pBackslash, L"\\conhost.exe")) + { + SetThemeAppProperties(STAP_ALLOW_NONCLIENT); + } + } + } + g_hObserverThread = CreateThread(NULL, NULL, ObserverThreadProc, NULL, NULL, NULL); SetPriorityClass(g_hObserverThread, REALTIME_PRIORITY_CLASS); SetThreadPriority(g_hObserverThread, THREAD_PRIORITY_TIME_CRITICAL);