How can I implement macOS-style modifier + trackpad zoom (system-wide magnifier) on Windows using Win32/C#?
I am trying to recreate the macOS accessibility zoom feature on Windows.
On macOS, holding Control and performing a two-finger scroll on the trackpad triggers a system-wide zoom:
- The entire screen zooms
- The zoom centers on the mouse cursor
- Moving the mouse pans the magnified area
- This works consistently across all applications
I am attempting to implement the same behavior on Windows using:
- C#
- Low-level mouse hooks (WH_MOUSE_LL)
- Windows Magnification API (Magnification.dll)
My approach:
- Install a WH_MOUSE_LL hook
- Detect CTRL + mouse wheel (two-finger trackpad scroll)
- Adjust magnification via MagSetFullscreenTransform
- Recenter the zoom based on GetCursorPos
The magnifier itself works, and panning follows the mouse correctly WHEN input is received.
However, I am running into a major limitation:
❗ The mouse wheel input is ONLY detected when the cursor is over the console window that launched the process.
❗ When the cursor is over other applications (e.g. Chrome), the hook does not receive wheel events.
❗ As a result, CTRL + two-finger scroll only zooms when hovering over the console window.
❗ Regular mouse wheel events DO propagate globally, but trackpad gestures do not.
Observations:
- This occurs even when the executable is run outside Visual Studio
- It happens regardless of administrator privileges
- Some apps (e.g. Ableton Live) partially work, others (Chrome) do not
- Keyboard-based zoom (CTRL +/-) still works globally, so magnification itself is not the issue
I suspect this relates to how Windows handles trackpad gestures, WM_GESTURE / WM_POINTER / precision touchpad input, and how those events bypass low-level mouse hooks.
Questions:
- Is it possible to implement macOS-style modifier + trackpad zoom system-wide on Windows at all?
- If so, should this be done via Raw Input / WM_POINTER / HID instead of WH_MOUSE_LL?
- Are trackpad scroll gestures intentionally not exposed to global mouse hooks?
- Is this behavior a known architectural limitation of Windows input handling?
I am not trying to zoom within a specific application — this must be system-wide, OS-level magnification.
Any insight into the correct Windows-native approach would be greatly appreciated.
if (wParam == (IntPtr)WM_MOUSEWHEEL && ctrlDown)
{
_currentZoom += wheelDelta / 1200f;
MagSetFullscreenTransform(_currentZoom, xOffset, yOffset);
}