From aeeb3620450f63709c1b672743f6bdeb85928fcb Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Sat, 6 Aug 2022 04:39:04 +0300 Subject: [PATCH] HideExplorerSearchBar: Fixed on OS builds 22621+ --- ExplorerPatcher/HideExplorerSearchBar.c | 17 ++++++----------- ExplorerPatcher/HideExplorerSearchBar.h | 1 + 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ExplorerPatcher/HideExplorerSearchBar.c b/ExplorerPatcher/HideExplorerSearchBar.c index 10d6ce0..ae698d3 100644 --- a/ExplorerPatcher/HideExplorerSearchBar.c +++ b/ExplorerPatcher/HideExplorerSearchBar.c @@ -103,19 +103,14 @@ LRESULT CALLBACK HideExplorerSearchBarSubClass( DWORD_PTR dwRefData ) { - switch (uMsg) + if (uMsg == WM_SIZE || uMsg == WM_PARENTNOTIFY) + { + if (uMsg == WM_SIZE && IsWindows11Version22H2OrHigher()) HideExplorerSearchBar(hWnd); + else if (uMsg == WM_PARENTNOTIFY && (WORD)wParam == 1) HideExplorerSearchBar(hWnd); + } + else if (uMsg == WM_DESTROY) { - case WM_PARENTNOTIFY: - if ((WORD)wParam == 1) - { - HideExplorerSearchBar(hWnd); - } - break; - - case WM_DESTROY: RemoveWindowSubclass(hWnd, HideExplorerSearchBarSubClass, (UINT_PTR)HideExplorerSearchBarSubClass); - break; } - return DefSubclassProc(hWnd, uMsg, wParam, lParam); } \ No newline at end of file diff --git a/ExplorerPatcher/HideExplorerSearchBar.h b/ExplorerPatcher/HideExplorerSearchBar.h index 0c39a9f..21d44b2 100644 --- a/ExplorerPatcher/HideExplorerSearchBar.h +++ b/ExplorerPatcher/HideExplorerSearchBar.h @@ -3,6 +3,7 @@ #include #include #pragma comment(lib, "Comctl32.lib") +#include "osutility.h" // https://stackoverflow.com/questions/30141592/how-do-i-find-a-handle-inside-a-control HWND FindChildWindow(