How can I implement macOS-style modifier + trackpad zoom (system-wide magnifier) on Windows using Win32/C#?

ketan sharma 0 Reputation points
2025-12-06T06:38:33.41+00:00

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:

  1. Is it possible to implement macOS-style modifier + trackpad zoom system-wide on Windows at all?
  2. If so, should this be done via Raw Input / WM_POINTER / HID instead of WH_MOUSE_LL?
  3. Are trackpad scroll gestures intentionally not exposed to global mouse hooks?
  4. 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);

}

Windows development | Windows API - Win32
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.