microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.61k stars 6.57k forks source link

FindMyMouse is behind start menu #14718

Open jonaskohl opened 2 years ago

jonaskohl commented 2 years ago

Microsoft PowerToys version

0.51.0

Running as admin

Area(s) with issue?

Mouse Utilities

Steps to reproduce

  1. Open the start menu
  2. Press Left Ctrl twice

✔️ Expected Behavior

The Find My Mouse spotlight should appear in front of everything, including the start menu

❌ Actual Behavior

The spotlight goes behind the start menu and taskbar

Screenshot: findmymouse_behind_startmenu

Possibly related to #14338

Other Software

Windows 10 Prro 21H1 (Build 19043.1348)

Jay-o-Way commented 2 years ago

Yes, that has been mentioned before and it turns out that start menu takes top priority. Not much (aka nothing) to do about it unfortunately.

jonaskohl commented 2 years ago

After a quick search, I found that it has something to do with UIAccess. Although the solution I found was for Windows 8's Metro UI, but maybe it still applies to Windows 10/11: https://stackoverflow.com/a/14666283

franky920920 commented 2 years ago

After a quick search, I found that it has something to do with UIAccess. Although the solution I found was for Windows 8's Metro UI, but maybe it still applies to Windows 10/11: https://stackoverflow.com/a/14666283

Thanks for your information! cc: @jaimecbernardo / @crutkas FYI, I'll let this one be the tracking issue.

franky920920 commented 2 years ago

ref: #14405

crutkas commented 2 years ago

UIAccess is typically reserved for accessibly.

We may have an idea on how to fix it but start menu tends to be one of those items that will always win "always on top" fight :)

crutkas commented 2 years ago

Variant of this is https://github.com/microsoft/PowerToys/issues/14178

gexgd0419 commented 1 year ago

This blog Window z-order in Windows 10 talks about different window z-order "bands". Z-order bands define groups of z-orders, and each window belongs to a band. If band A has a higher z-order than band B, none of the windows in band B (including "always on top" ones) can show above the windows in band A.

That's how Windows makes Start menu, notification pane, task manager window (with always on top enabled), Xbox game bar, snip & sketch, Alt-Tab switcher, task view, and even lock screen, to always show above the windows of regular programs. All regular windows are in band ZBID_DESKTOP, which has the lowest z-order. A topmost window of a UIAccess-enabled process will be in band ZBID_UIACCESS, which has the highest z-order, even higher than the lock screen.

Unfortunately, there's no documented way to create windows in a specific band or to change the band a window belongs to. Even though the undocumented API functions CreateWindowInBand(), SetWindowBand(), etc. have been discovered, you cannot use them directly because Microsoft deliberately restricts their use by checking the signature and some special PE header of the caller process, ensuring that only approved built-in system programs can do this. You can get around this by injecting into an approved process, but it's not recommended or supported, and using undocumented APIs is not recommended anyway.

So, as far as I know, for third-party programs, UIAccess may be the only documented, supported, legitimate way to put their windows above those system UI windows.