microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.05k stars 6.53k forks source link

ProcessExplorer-ish #33934

Open dgzargo opened 3 months ago

dgzargo commented 3 months ago

Description of the new feature / enhancement

The app should provide the ability to track which process is running the UI selected by mouse. Something like Snoop does with WPF.

Scenario when this would be used?

It could help understand which process is doing bad on your screen. Use case:

  1. Launch the app.
  2. Click on a UI you are interested in.
  3. A window with arbitrary info opens. (e.g. PID, exe path, etc.) And it could help finding malicious processes if someone needs. Example: Which process did THIS? I have no information about the app, but I'm sure I need to offer my help to it!

Supporting information

No response

dgzargo commented 3 months ago

AutoHotKey helped me. Proof of concept:

#Requires AutoHotkey v2.0
#SingleInstance force

~LButton::
{
    try {
        window := WinGetId("A")
        thread_id := DllCall("user32\GetWindowThreadProcessId", "ptr", window, "uint")
        MsgBox("PID of the window under the mouse cursor is " thread_id, "PID finder script")
    } catch Error as err {
        MsgBox(err.Message, "PID finder script")
    } finally {
        ExitApp
    }
}