Disable Middle Click New Tab in Explorer
Makes the middle mouse button do nothing in File Explorer, instead of opening folders in a new tab
Author: luizgununes
In Windows 11, middle-clicking a folder in File Explorer opens it in a new tab.
This mod drops the middle button inside Explorer so nothing happens at all.
Only File Explorer windows are affected. The desktop, the taskbar and every
other application keep their normal middle-click behavior: the mod runs inside
explorer.exe alone, and there it only drops clicks aimed at the file list or
the folder tree.
Scope
Each of the two surfaces has its own switch in the settings:
- File list - the main pane with the files and folders.
- Navigation pane - the folder tree on the left.
Why it works this way
The middle-button messages are dropped on their way to the window procedure,
by hooking DispatchMessageW and returning without calling the original.
PeekMessageW is hooked as well, rewriting the same messages to WM_NULL,
because Explorer runs inner modal loops - drag detection after a button press,
for one - that pull messages straight out of the queue instead of going
through the main pump.
GetMessageW is deliberately not hooked. It blocks until a message arrives,
so a hook frame would sit on the stack of every idle message loop in
explorer.exe for as long as it waits, and Windhawk could not unmap the mod
while that is true - disabling or updating the mod would hang in the
"unloading" state.
Interaction with other mods
Because the clicks are dropped before the window procedure runs, other mods
that act on the middle button in these two surfaces stop seeing it while this
mod is enabled - autoscroll-win32, for example. Mods keyed off
WM_PARENTNOTIFY, such as click-on-empty-explorer, still fire, since the
system sends that notification when the message is queued rather than when it
is delivered.