diff --git a/ExplorerPatcher/TaskbarCenter.c b/ExplorerPatcher/TaskbarCenter.c index ab4aeda..cfbcff3 100644 --- a/ExplorerPatcher/TaskbarCenter.c +++ b/ExplorerPatcher/TaskbarCenter.c @@ -17,7 +17,7 @@ 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")) + if (!wcscmp(wszClassName, L"MSTaskListWClass")) { TaskbarCenter_Notify(); } @@ -26,18 +26,18 @@ BOOL GetClientRectHook(HWND hWnd, LPRECT lpRect) HRESULT TaskbarCenter_Initialize(HMODULE hExplorer) { + if (!(hEvent = CreateEventW(NULL, TRUE, FALSE, TASKBAR_CHANGED_NOTIFICATION))) + { + return E_NOTIMPL; + } + if (FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL)) + { + return E_NOTIMPL; + } // 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 index 740b270..717d761 100644 --- a/ExplorerPatcher/TaskbarCenter.h +++ b/ExplorerPatcher/TaskbarCenter.h @@ -4,7 +4,7 @@ #include #include -#define TASKBAR_CHANGED_NOTIFICATION L"Global\\ExplorerPatcher_TaskbarChangedNotification" +#define TASKBAR_CHANGED_NOTIFICATION L"Global\\ExplorerPatcher_TaskbarChangedNotification_{B37553B7-425C-44F6-A04A-126849EE59CB}" HRESULT TaskbarCenter_Initialize(HMODULE); #endif \ No newline at end of file