Create taskbar-ctrl-rightclick-open-file-location.wh.cpp#4058
Create taskbar-ctrl-rightclick-open-file-location.wh.cpp#4058triatomic wants to merge 5 commits into
Conversation
New mod: hold a configurable modifier (default Ctrl) while right-clicking a taskbar button to open the running program's file location in Explorer, copy its path to the clipboard, or launch a new elevated instance. Targets the classic taskbar (MSTaskListWClass) used by stock Windows 10, Windows 11 with StartAllBack, and ExplorerPatcher in legacy mode. The suppression of the jump-list/context menu is done by subclassing the taskbar window, and the button-to-process resolution uses MSAA plus the exe's FileDescription, so no private taskbar.dll symbols are required.
|
Any thoughts about supporting the Windows 11 taskbar? I believe that's what most Windhawk users use. windhawk-mods/mods/taskbar-volume-control.wh.cpp Lines 1541 to 1557 in 22ec451 |
Add support for the native Windows 11 XAML taskbar. - Hook the wndproc of Windows.UI.Input.InputSite.WindowClass (under DesktopWindowContentBridge under Shell_TrayWnd) to intercept the configured pointer event before XAML opens the jump list. Inputsite.dll rejects subclassing, so use WindhawkUtils::SetFunctionHook on the wndproc instead. - New taskbarType setting (auto / classic / win11) to pick which path(s) to install. Auto attaches both. - Hook CreateWindowExW and CreateWindowInBand to catch InputSite windows created after init (secondary monitor attach, taskbar relocation). - For button identification on Win11, IUIAutomation::ElementFromPoint descends into the XAML tree where AccessibleObjectFromPoint stops at the DesktopWindowXamlSource host. The button's UIA Name feeds the existing FindWindowByLabel / FileDescription matching.
|
Updated to support native windows 11. |
- Fix IUIAutomation Release on wrong thread (now released on the COM apartment that created it via WM_APP_RELEASE_UIA). - Wh_ModSettingsChanged now re-applies hooks when taskbarType changes. - Retry taskbar attach when the mod loads before explorer's taskbar is up (e.g. on explorer.exe start). - Remove redundant -DWINVER=0x0A00 from @compilerOptions.
- Limit Shell_TrayWnd/Shell_SecondaryTrayWnd enumeration to the current process; skip foreign-process top-levels. - Win11 taskbar: get the represented window's HWND directly from UIA's NativeWindowHandle on the TaskListButton, removing the brittle title/FileDescription mapping for the Win11 path. MSAA remains the fast primary path for the classic taskbar.
| BSTR bName = nullptr; | ||
| cur->get_CurrentName(&bName); | ||
| UIA_HWND uHwnd = nullptr; | ||
| cur->get_CurrentNativeWindowHandle(&uHwnd); |
There was a problem hiding this comment.
Does this work? If I understand correctly get_CurrentNativeWindowHandle returns the window handle of the button (explorer.exe). But there's also info about the target window:
AutomationId: "Window: 0x10750"
You can use inspect.exe to see it.
| } | ||
| } | ||
| Wh_Log(L"Late taskbar attach gave up"); | ||
| }).detach(); |
There was a problem hiding this comment.
This will crash if the mod is unloaded while the thread is running. Generally, you shouldn't need a thread if you're hooking CreateWindowExW. You can look at how existing mods do it.
It's best to just hook the creation functions regardless of the mode in the settings. Then, when settings are changed, you don't need to set different hooks, which I mentioned in another comment.
Also, this won't work for newly added taskbars (e.g. attached monitor). Window creation hooks will.
Summary
New mod: hold a configurable modifier (default Ctrl) while clicking a taskbar button to:
Works on the classic taskbar (
MSTaskListWClass):The mod subclasses
MSTaskListWClassso the right-click never reaches the taskbar's own context-menu handler (this is what makes it work on StartAllBack, which doesn't go throughtaskbar.dll's_ComputeJumpViewPosition). Button-to-process resolution uses MSAAAccessibleObjectFromPointand, when the accessible value doesn't expose an HWND directly (the StartAllBack case), a fallback that matches against the exe'sFileDescriptionversion-info field with alphanumeric normalization (handles e.g.ConEmu (x64)↔ConEmu64.exe,MSI Afterburner↔MSIAfterburner.exe).Settings
Mod authorship
This mod was created by:
Test plan
.exelocation in Explorer without showing the SAB jump list.exe