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) { - case WM_PARENTNOTIFY: - if ((WORD)wParam == 1) - { - HideExplorerSearchBar(hWnd); - } - break; - - case WM_DESTROY: - RemoveWindowSubclass(hWnd, HideExplorerSearchBarSubClass, (UINT_PTR)HideExplorerSearchBarSubClass); - break; + if (uMsg == WM_SIZE && IsWindows11Version22H2OrHigher()) HideExplorerSearchBar(hWnd); + else if (uMsg == WM_PARENTNOTIFY && (WORD)wParam == 1) HideExplorerSearchBar(hWnd); + } + else if (uMsg == WM_DESTROY) + { + RemoveWindowSubclass(hWnd, HideExplorerSearchBarSubClass, (UINT_PTR)HideExplorerSearchBarSubClass); } - 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(