From 4b0bae46c5a1650504ee1dc2da64f777553838e8 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Fri, 10 Dec 2021 00:12:12 +0200 Subject: [PATCH] When restarting Explorer from Properties, taskbar position is reapplied only when it differes from the previous value --- ExplorerPatcher/GUI.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index 2b284fe..d5512a5 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -7,6 +7,8 @@ BOOL g_darkModeEnabled = FALSE; static void(*RefreshImmersiveColorPolicyState)() = NULL; static BOOL(*ShouldAppsUseDarkMode)() = NULL; DWORD dwTaskbarPosition = 3; +DWORD dwInitialTaskbarPosition = 3; + BOOL IsHighContrast() { HIGHCONTRASTW highContrast; @@ -799,7 +801,10 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) GetWindowsDirectoryW(wszPath, MAX_PATH); wcscat_s(wszPath, MAX_PATH, L"\\explorer.exe"); Sleep(1000); - GUI_RegSetValueExW(NULL, L"Virtualized_" _T(EP_CLSID) L"_TaskbarPosition", NULL, NULL, &dwTaskbarPosition, NULL); + if (dwTaskbarPosition != dwInitialTaskbarPosition) + { + GUI_RegSetValueExW(NULL, L"Virtualized_" _T(EP_CLSID) L"_TaskbarPosition", NULL, NULL, &dwTaskbarPosition, NULL); + } ShellExecuteW( NULL, L"open", @@ -2083,6 +2088,7 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin } } GUI_RegQueryValueExW(NULL, L"Virtualized_" _T(EP_CLSID) L"_TaskbarPosition", NULL, NULL, &dwTaskbarPosition, NULL); + dwInitialTaskbarPosition = dwTaskbarPosition; HWND hwnd = CreateWindowEx( NULL, L"ExplorerPatcher_GUI_" _T(EP_CLSID),