Skip to content

API for windows handles (HWNDs) #1207

@JoyHak

Description

@JoyHak

Is there an existing issue for this?

  • I have searched the existing issues

Proposal

Hello. I am a developer of a utility that collects the paths of active file managers and displays them as Menu. It can be used to send paths between different file managers, to switch the path in the active file dialog.

Image

Does Whim have an API to get the windows from specific workspace? Or their hwnds at least (if it's possible)? Preferably a COM object or legacy messages (WM_COPYDATA, WM_USER etc).

[AutoHotkey Script] 
       |
       | ComObjActive("Whim.WorkspaceManager")
       v
+---------------------------+
| Whim.WorkspaceManager     |
| ProgID: Whim.WorkspaceMgr |
+---------------------------+
         |                  \
         | ActiveWorkspace   | Workspaces.Count
         v                   \
+---------------------------+ 
| IWorkspace (active)     |
| ├── Name: "Workspace 1"   |
| ├── Index: 2              | 
| └── Windows → Collection  |
+---------------------------+
         |
         | Windows.Item(n)
         v
    +------------+    +------------+
    | IWindow #1 |    | IWindow #2 |
    | Title:"A"  |    | Title:"B"  |
    | HWND:0x123 |    | HWND:0x456 |
    | PID:1234   |    | PID:5678   |
    +------------+    +------------+
           |                 |
           +--------+--------+
                    |
                    v
              [ListView GUI]
              Chrome | 0x123 | 1234
              Notes  | 0x456 | 5678

Alternatives

Another quick and most versatile way of communication is to copy all handles into a clipboard. I use this idea extensively in the whole project (and I keep in mind that it may be closed for reading occasionally). Multiple read/copy requests usually take up to 30-50ms which is faster than SendMessage sometimes.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions