I'm writing a script (in C#, but almost everything is handled via pinvoke) that finds the window handle under the mouse pointer and allows the user to take some action on it (primarily custom-bounded-window-snapping related functionality).
I've got it to the point where it works really really well! It can move the desktop and taskbar. This is of course, something I don't actually want it to do. I only want it to work on windows the user has brought into being; things like Chrome, Word, Notepad, or Teams.
Is there some handy delineation I can look at? I've tried looking at window styles, or PID, but I don't see an obvious pattern on how to detect "this 'window' is owned by the Windows shell".
I realized -- I have checked to see if the window handle belongs to explorer.exe
, but that doesn't work as it prevents the user from moving regular file browsers.