1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-28 09:21:02 +01:00

Taskbar11: Fix right click menu and double click to auto-hide on OS builds 22621+

This commit is contained in:
Valentin Radu 2022-08-07 00:07:04 +03:00
parent 25660c908a
commit 0a42d5559f

View File

@ -2210,6 +2210,9 @@ BOOL IsPointOnEmptyAreaOfNewTaskbar(POINT pt)
IUIAutomationElement* pIUIAutomationElement = NULL; IUIAutomationElement* pIUIAutomationElement = NULL;
HWND hWnd = NULL; HWND hWnd = NULL;
BOOL bRet = FALSE; BOOL bRet = FALSE;
BSTR elemName = NULL;
BSTR elemType = NULL;
BOOL bIsWindows11Version22H2OrHigher = IsWindows11Version22H2OrHigher();
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
@ -2219,11 +2222,23 @@ BOOL IsPointOnEmptyAreaOfNewTaskbar(POINT pt)
{ {
hr = pIUIAutomation2->lpVtbl->ElementFromPoint(pIUIAutomation2, pt, &pIUIAutomationElement); hr = pIUIAutomation2->lpVtbl->ElementFromPoint(pIUIAutomation2, pt, &pIUIAutomationElement);
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr) && bIsWindows11Version22H2OrHigher)
{
hr = pIUIAutomationElement->lpVtbl->get_CurrentName(pIUIAutomationElement, &elemName);
}
if (SUCCEEDED(hr) && bIsWindows11Version22H2OrHigher)
{
hr = pIUIAutomationElement->lpVtbl->get_CurrentClassName(pIUIAutomationElement, &elemType);
}
if (SUCCEEDED(hr) && bIsWindows11Version22H2OrHigher)
{
bRet = (!wcscmp(elemName, L"") && !wcscmp(elemType, L"Taskbar.TaskbarFrameAutomationPeer"));
}
if (SUCCEEDED(hr) && !bIsWindows11Version22H2OrHigher)
{ {
hr = pIUIAutomationElement->lpVtbl->get_CurrentNativeWindowHandle(pIUIAutomationElement, &hWnd); hr = pIUIAutomationElement->lpVtbl->get_CurrentNativeWindowHandle(pIUIAutomationElement, &hWnd);
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr) && !bIsWindows11Version22H2OrHigher)
{ {
WCHAR wszClassName[200]; WCHAR wszClassName[200];
GetClassNameW(hWnd, wszClassName, 200); GetClassNameW(hWnd, wszClassName, 200);
@ -2304,6 +2319,14 @@ BOOL IsPointOnEmptyAreaOfNewTaskbar(POINT pt)
} }
} }
} }
if (elemName)
{
SysFreeString(elemName);
}
if (elemType)
{
SysFreeString(elemType);
}
if (pIUIAutomationElement) if (pIUIAutomationElement)
{ {
pIUIAutomationElement->lpVtbl->Release(pIUIAutomationElement); pIUIAutomationElement->lpVtbl->Release(pIUIAutomationElement);