How can I capture all application/window messages from start of process? [closed]

随声附和 提交于 2019-12-22 17:42:12

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/18680488/how-can-i-capture-all-application-window-messages-from-start-of-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!