要获得有关WinForm或Web应用程序使用情况的更多信息,我想捕获鼠标移动和点击信息。如果可以将其渲染成图像,那将是完美的。
结果将是这样的:
问题是如何开始创建这样的应用程序?
(任何人都知道是否有可以执行此操作的免费/廉价应用程序的开源)
IOGraphica能够做到这一点,但它是Java版本,它是免费的,但不是开源的。
答案 0 :(得分:2)
我会尝试捕获 Windows的任何鼠标移动/点击并将其存储在一个集合中。当您完成录制时 - 尝试绘制图片。我建议在谷歌中寻找“c#capture mouse”或“mouse hook”。前段时间我这样做是为了获得键盘钩。您可以查看Processing Global Mouse Events。
就代码而言,这可能有所帮助:
Dictionary<Point, MouseEventInfo> dict = new Dictionary<Point, MouseEventInfo>();
/// see given link to find the correct way to get this kind of event
public void mouse_event(....)
{
/// get mouse coordinates
/// create point struct
/// check if point exists in DICT
/// no - add new MouseEventInfo at Point
/// yes - access MouseEventInfo object and increase a value according to the event
}
public void onFinished()
{
/// create new bitmap/image - width/height according to your screen resultion
/// iterate through all MouseEventInfo objects and draw any information
}
/// stores mouse event info for a point
class MouseEventInfo
{
Point p;
int moved=0;
int clicked=0;
int doubleClicked=0;
}
我知道这只是一个伪代码 - 无论如何 - 我希望这可以帮到你!啊 - 请记住,任何类型的钩子(键盘,鼠标或其他任何东西)都可能导致你的antiVir病毒警报。
HTH
答案 1 :(得分:1)
如果您正在寻找可以在外部运行并跟踪鼠标移动和点击的内容,您可能会发现在codeproject.com上这个鼠标/键盘挂钩项目非常有用:
http://www.codeproject.com/KB/system/globalmousekeyboardlib.aspx
有一个示例应用程序和一个完整源代码的挂钩库。这是你努力的起点。