获取活动窗口的名称 [英] Getting the name of the active window
本文介绍了获取活动窗口的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 Windows 上编写一个 python 脚本来保存用户在给定时间使用的程序的标题,比如 http://www.rescuetime.com .出于隐私考虑,我不想使用救援时间,而是编写了一个脚本来执行类似自己的操作,以捕获有关我使用计算机的次数的数据.
I want to write a python script on Windows that saves the title of the program that the user uses at a given time like the http://www.rescuetime.com . I don't want to use rescuetime because of privacy consideration but instead write a script that does something similar myself to capture data about how much I use my computer.
是否有一些简单的命令可以用来读取这些信息?
Is there some easy command that I can use to read that information?
推荐答案
import win32gui
w=win32gui
w.GetWindowText (w.GetForegroundWindow())
这篇关于获取活动窗口的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文