Magnifier Control unable to magnify the taskbar start menu

Johannes Bergman 41 Reputation points
2020-07-29T06:43:09.907+00:00

I've modified the MagnifierSample from the Windows-classic-samples, turning it into a lens magnifier. However when I open the Start Menu by pressing the Start button my magnification lens window is pushed to the background and is unable to magnify the start menu. Is this by design or are we able to overcome this? I wish to build a magnifier doing this for accessibility features. The built-in Magnifier is able to overcome this as seen below:

Windows built-in magnifier:
14200-windows-magnifier.jpg

My modified sample:
14226-my-magnifier-2.jpg

I use...

CreateWindowEx(WS_EX_TOPMOST | WS_EX_LAYERED | WS_EX_TRANSPARENT,  
 WindowClassName, WindowTitle,  
 RESTOREDWINDOWSTYLES,  
 0, 0, hostWindowRect.right, hostWindowRect.bottom, NULL, NULL, hInst, NULL);  

...to create the host window. And...

SetWindowPos(hwndHost, HWND_TOPMOST, mousePoint.x - (int)(MAGFACTOR * width / 2), mousePoint.y - (int)(MAGFACTOR * height / 2), width, height,  
 SWP_NOACTIVATE | SWP_NOSIZE);  

...to reposition and reclaim topmost status.

However, the start menu appears immune to this and will always have topmost status no matter what. Seeing as the built-in magnifier is able to lens magnify the taskbar and start menu I hope it is possible to do as well. Does anyone know what needs to be done or if it is possible to do at all?

Thank you!

The full modified source code:
MagnifierSample.cpp

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,652 questions
{count} votes

Accepted answer
  1. Fei Xue - MSFT 1,111 Reputation points
    2020-07-31T02:02:23.427+00:00

    We need to make it a Accessibility app by setting uiAcess=true in the manifest, sign the executable, and placing it in a secure location (e.g. Program Files) as described below:

    1. Set uiAccess=true in the manifest
      Set this option in Visual Studio by setting Linker | Manifest File | UAC Bypass UI Protection to Yes
    2. Sign the executable
      See https://learn.microsoft.com/en-us/previous-versions/bb756995(v=msdn.10)
    3. Place it in a secure location
      See https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/user-account-control-only-elevate-uiaccess-applications-that-are-installed-in-secure-locations
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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