我怎样才能捕捉过程的开始所有的应用程序/窗口消息? [英] How can I capture all application/window messages from start of process?

查看:192
本文介绍了我怎样才能捕捉过程的开始所有的应用程序/窗口消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚到底我可以捕获一个过程/窗口的所有窗口的消息,它在C#中推出的时间。这个过程不会是我自己的,所以我需要使用某种形式的挂钩。我的目标是,开始从初始窗口创建之前捕获实时的所有邮件,向应用程序将退出并输出到一个文本框或文件中的所有信息。所以基本上从被执行的应用程序的那一刻。



因为我想从它推出的时间捕捉到它,我可能不会有一个窗口句柄作为他们就没有处理呢。所以,我geussing它可能会非常棘手。



他们是做这个工作,我可以借鉴的应用程序?我只希望从应用程序的所有消息。


解决方案

我的目标是开始捕捉所有消息从
的初始窗口创建,该应用程序将退出与输出都
消息到文本框或文件之前实时的。




听起来像是你想要的注册表,文件系统,进程和放大器的实时监控;等活动



进程监视器做这一切已经和你可以挂接到使用的 EasyHook




因为我想从它推出的时间捕捉到它,我大概
不会有一个窗口句柄作为他们的将是无柄呢。所以我
geussing它可能会非常棘手




这代码项目的文章有防止不被允许的软件出现在名单上的任何程序执行的方法在特定的计算机上运行。也许你可以适应,以满足您的需求。 http://www.codeproject.com /文章/ 11985 /挂钩的非原生API和控制过程,CRE



如果你想有一个较低水平的方法,我建议你阅读起来在钩子和DLL


I am trying to figure out exactly how I can capture all window messages of a process/window, from the time it was launched in c#. The process would not be my own so I would need to use some kind of hook. My goal is to start capturing all messages in real time from before the initial window creation, to the applications exit and output all messages to a textbox or file. So basically from the moment the application was executed.

Since I want to capture it from the time it was launched, I probably wont have a window handle as their will be no handle yet. So I am geussing it could be tricky.

Is their an application that does this that I can use for reference? I only want all messages from on application.

解决方案

My goal is to start capturing all messages in real time from before the initial window creation, to the applications exit and output all messages to a textbox or file.

Sounds like you want the "Real-Time' monitoring of Registry, File System, Process & etc activity.

Process Monitor does all this already and you can hook into it using EasyHook

Since I want to capture it from the time it was launched, I probably wont have a window handle as their will be no handle yet. So I am geussing it could be tricky.

This Code Project article has a method for preventing execution of any program that does not appear on the list of software that is allowed to run on a particular machine. Perhaps you could adapt it to suit your needs. http://www.codeproject.com/Articles/11985/Hooking-the-native-API-and-controlling-process-cre

If you want a low level approach I recommend reading up on Hooks and Dlls.

这篇关于我怎样才能捕捉过程的开始所有的应用程序/窗口消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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