如何找到当前焦点的程序? [英] How do I find the program with the current focus?

查看:188
本文介绍了如何找到当前焦点的程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何知道哪个进程具有当前的焦点?

How can I know which process has the current focus?

编辑:Windows操作系统,从XP到7的任何地方

推荐答案

致电 GetForegroundWindow 获取焦点窗口的句柄,然后调用 GetWindowThreadProcessId 来获取创建该窗口的进程的ID。你用这个ID做什么取决于你。

Call GetForegroundWindow to get the handle of the focused window, and then call GetWindowThreadProcessId to get the ID of the process that created that window. What you do with that ID is up to you.

这篇关于如何找到当前焦点的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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