如何通过自动热键中的PID获取窗口句柄? [英] How to get window handle by PID in autohotkey?

查看:102
本文介绍了如何通过自动热键中的PID获取窗口句柄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过自动热键中的PID获取窗口句柄,因为窗口的标题始终在变化.如果有人想知道,我想获取last.fm主窗口的句柄.

I want to get window handle by PID in autohotkey, because title of the window is always changing. If anyone wonder, I want to get handle of last.fm main window.

推荐答案

您可以使用 WinGet命令,其Cmd参数为 ID .

You can use the WinGet command with the Cmd paramter as ID.

Cmd是要执行的操作,如果为空白,则默认为ID.
ID:检索窗口的唯一ID号.也称为窗口句柄(HWND).

Cmd is the operation to perform, which if blank defaults to ID.
ID: Retrieves the unique ID number of a window. Also known as the window handle (HWND).

WinTitle 可以是PID.

WinGet, UniqueID, ID, ahk_pid %VarContainingPID%

另一个选项是 WinExist()

UniqueID := WinExist("ahk_pid" . VarContainingPID)

这篇关于如何通过自动热键中的PID获取窗口句柄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆