diff --git a/ExplorerPatcher/ExplorerPatcher.vcxproj b/ExplorerPatcher/ExplorerPatcher.vcxproj
index 4885bbc..4456945 100644
--- a/ExplorerPatcher/ExplorerPatcher.vcxproj
+++ b/ExplorerPatcher/ExplorerPatcher.vcxproj
@@ -203,6 +203,7 @@
+
@@ -218,6 +219,7 @@
+
diff --git a/ExplorerPatcher/ExplorerPatcher.vcxproj.filters b/ExplorerPatcher/ExplorerPatcher.vcxproj.filters
index 5c9fca2..25f9835 100644
--- a/ExplorerPatcher/ExplorerPatcher.vcxproj.filters
+++ b/ExplorerPatcher/ExplorerPatcher.vcxproj.filters
@@ -54,6 +54,9 @@
Header Files
+
+ Header Files
+
@@ -94,6 +97,9 @@
Source Files
+
+ Source Files
+
diff --git a/ExplorerPatcher/TaskbarCenter.c b/ExplorerPatcher/TaskbarCenter.c
new file mode 100644
index 0000000..ab4aeda
--- /dev/null
+++ b/ExplorerPatcher/TaskbarCenter.c
@@ -0,0 +1,43 @@
+#include "TaskbarCenter.h"
+
+HANDLE hEvent;
+
+BOOL TaskbarCenter_Notify()
+{
+ if (hEvent)
+ {
+ SetEvent(hEvent);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL GetClientRectHook(HWND hWnd, LPRECT lpRect)
+{
+ wchar_t wszClassName[100];
+ ZeroMemory(wszClassName, 100);
+ GetClassNameW(hWnd, wszClassName, 100);
+ if (!wcscmp(wszClassName, L"Shell_TrayWnd") || !wcscmp(wszClassName, L"Shell_SecondaryTrayWnd"))
+ {
+ TaskbarCenter_Notify();
+ }
+ return GetClientRect(hWnd, lpRect);
+}
+
+HRESULT TaskbarCenter_Initialize(HMODULE hExplorer)
+{
+ // This is one of the methods called by explorer!CTaskListWnd::_RecomputeLayout
+ if (!VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", GetClientRectHook))
+ {
+ return E_NOTIMPL;
+ }
+ if (!(hEvent = CreateEventW(NULL, TRUE, FALSE, TASKBAR_CHANGED_NOTIFICATION)))
+ {
+ return E_NOTIMPL;
+ }
+ if (GetLastError() == ERROR_ALREADY_EXISTS)
+ {
+ return E_NOTIMPL;
+ }
+ return S_OK;
+}
\ No newline at end of file
diff --git a/ExplorerPatcher/TaskbarCenter.h b/ExplorerPatcher/TaskbarCenter.h
new file mode 100644
index 0000000..740b270
--- /dev/null
+++ b/ExplorerPatcher/TaskbarCenter.h
@@ -0,0 +1,10 @@
+#ifndef _H_TASKBARCENTER_H_
+#define _H_TASKBARCENTER_H_
+#include
+#include
+#include
+
+#define TASKBAR_CHANGED_NOTIFICATION L"Global\\ExplorerPatcher_TaskbarChangedNotification"
+
+HRESULT TaskbarCenter_Initialize(HMODULE);
+#endif
\ No newline at end of file
diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c
index 921e16c..4d33861 100644
--- a/ExplorerPatcher/dllmain.c
+++ b/ExplorerPatcher/dllmain.c
@@ -28,6 +28,7 @@
#include "HideExplorerSearchBar.h"
#include "StartMenu.h"
#include "GUI.h"
+#include "TaskbarCenter.h"
#define WINX_ADJUST_X 5
#define WINX_ADJUST_Y 5
@@ -1549,9 +1550,21 @@ __declspec(dllexport) DWORD WINAPI main(
ArchiveMenuThread,
params,
0,
+ 0,
0
);
}
+
+
+ // This notifies applications when the taskbar has recomputed its layout
+ if (SUCCEEDED(TaskbarCenter_Initialize(hExplorer)))
+ {
+ printf("Initialized taskbar update notification.\n");
+ }
+ else
+ {
+ printf("Failed to register taskbar update notification.\n");
+ }
}
else
{