从另一个 Windows 应用程序捕获用户事件(按钮点击等)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8679307/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Capturing user events (button clicks etc) from another Windows application
提问by elliotcw
I'm looking to write a .Net Windows application that will capture how a user uses another running application.
我希望编写一个 .Net Windows 应用程序,它将捕获用户如何使用另一个正在运行的应用程序。
The simplest form of this would be recording which buttons were clicked or menu items were opened. Capturing the button text or menu text would be enough.
最简单的形式是记录单击了哪些按钮或打开了哪些菜单项。捕获按钮文本或菜单文本就足够了。
I know this can be done by listening for events but was unsure how far this stretched. In Windows are you able to listen to another applications events or are they hidden from other applications?
我知道这可以通过监听事件来完成,但不确定这会延伸多远。在 Windows 中,您是否能够侦听其他应用程序事件,或者它们是否对其他应用程序隐藏?
If so, are there any .Net libraries I can use or open source projects to catch these events? Taking this further, turn these into generic events (im thinking lots of applications might fire events specific to them, so extracting general information is key)
如果是这样,是否有任何我可以使用的 .Net 库或开源项目来捕获这些事件?更进一步,将这些转换为通用事件(我认为很多应用程序可能会触发特定于它们的事件,因此提取通用信息是关键)
If not, is the only solution to integrate my code with the application to gain access to the that applications events?
如果没有,将我的代码与应用程序集成以访问该应用程序事件的唯一解决方案是什么?
Many thanks
非常感谢
采纳答案by silverspoon
If I understand your post correctly, you need something similar to Spy++that can hook the Windows messages and tell you when that message gets fired.
如果我正确理解您的帖子,您需要类似于Spy++ 的东西,它可以挂钩 Windows 消息并告诉您该消息何时被触发。
Have a look at these links:
看看这些链接:
回答by Srinuvas
private void CaptureCameraCallback()
{
using (CvCapture cap = CvCapture.FromCamera(CaptureDevice.Any, 1))
{
while (true)
{
Bitmap bm = BitmapConverter.ToBitmap(cap.QueryFrame());
bm.SetResolution(pctCvWindow.Width, pctCvWindow.Height);
pctCvWindow.Image = bm;
}
}
}