如何在任何窗口获得焦点时捕获进程? [英] How to capture the process when any window gets focus?

查看:73
本文介绍了如何在任何窗口获得焦点时捕获进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在任何窗口获得焦点时捕获进程?





我的要求是捕获用户活动的详细信息一个db。当任何窗口聚焦在屏幕上时,如何捕获进程。我的意思是,当任何窗口获得焦点时,我想跟踪机器上任何事物的过程。



我试过方法 GetForegroundWindow() 给了我所需的详细信息。但我想知道当任何窗口获得焦点时自动触发的事件。如果我收到此事件,那么我将在此事件上调用方法 GetForegroundWindow()并获取更多详细信息。



任何人都可以帮我吗?



我尝试过:



GetForegroundWindow()

GetWindowText()

解决方案

Google用于windows挂钩,你会发现你需要的东西。

How to capture the process when any window gets focus?


My requirement is to capture the details of the user activity in a db. How can I capture the process when any window gets focus on the screen. I mean, I want to track the process for any thing on the machine when any window gets focus.

I tried for method GetForegroundWindow() which gives me the required details. But I wanted to know the event which gets triggered automatically when any window gets focus. If I get this event, then I will call the method GetForegroundWindow() on this event and will get the further details.

Can anyone help me on this?

What I have tried:

GetForegroundWindow()
GetWindowText()

解决方案

Google for "windows hooking" and you will find what you need.


这篇关于如何在任何窗口获得焦点时捕获进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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