1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-27 17:00:59 +01:00

Start menu positioning reliability enhancements

This commit is contained in:
Valentin Radu 2021-10-13 16:47:51 +03:00
parent fd0260f113
commit 21cc562f45

View File

@ -1083,7 +1083,11 @@ DEFINE_GUID(_uuidof_v13,
0x4F7F, 0x5DE5, 0xA5, 0x28,
0x7e, 0xfe, 0xf4, 0x18, 0xaa, 0x48
);
void PositionStartMenuForMonitor(HMONITOR hMonitor, DWORD location)
BOOL PositionStartMenuForMonitor(
HMONITOR hMonitor,
HDC unused1,
LPRECT unused2,
DWORD location)
{
HRESULT hr = S_OK;
HSTRING_HEADER hstringHeader;
@ -1161,6 +1165,7 @@ void PositionStartMenuForMonitor(HMONITOR hMonitor, DWORD location)
WindowsDeleteString(string);
RoUninitialize();
}
return TRUE;
}
void PositionStartMenu(INT64 unused, DWORD location)
@ -1175,7 +1180,7 @@ void PositionStartMenu(INT64 unused, DWORD location)
L"Shell_SecondaryTrayWnd",
NULL
);
PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), location);
PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), NULL, NULL, location);
} while (hWnd);
if (!hWnd)
{
@ -1185,14 +1190,16 @@ void PositionStartMenu(INT64 unused, DWORD location)
L"Shell_TrayWnd",
NULL
);
PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), location);
PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), NULL, NULL, location);
}
}
DWORD PositionStartMenuTimeout(INT64 timeout)
{
Sleep(timeout);
PositionStartMenu(0, GetStartMenuPosition());
printf("Started \"Position Start menu\" thread.\n");
EnumDisplayMonitors(NULL, NULL, PositionStartMenuForMonitor, GetStartMenuPosition());
printf("Ended \"Position Start menu\" thread.\n");
}
DWORD GetStartMenuPosition()
@ -1493,7 +1500,6 @@ DWORD SignalShellReady(DWORD wait)
0
);
*/
PositionStartMenu(0, GetStartMenuPosition());
/*printf("hook show desktop\n");
void* ShellTrayWndProcFuncT = GetWindowLongPtrW(hWnd, GWLP_WNDPROC);
if (ShellTrayWndProcHook != ShellTrayWndProcFuncT)
@ -1977,6 +1983,9 @@ __declspec(dllexport) DWORD WINAPI main(
{
RegCloseKey(hKey);
}
CreateThread(0, 0, PositionStartMenuTimeout, 0, 0, 0);
}
else
{