简体   繁体   English

如何在应用程序顶部绘制正方形,获取正方形的坐标/大小,并检查正方形下方的图像是否已更改?

[英]How do I draw squares on top of applications, get coordinates/size of the squares, and check to see if the image beneath the squares has changed?

I want to create a windows app. 我想创建一个Windows应用程序。 I want the user to be able to click a button on the app. 我希望用户能够在应用程序上单击一个按钮。 Once the button is clicked I want the user to draw a square somewhere on the screen... anywhere. 单击按钮后,我希望用户在屏幕上的任何地方绘制一个正方形。 The square will probably be drawn over another application window, so that window needs to ignore any clicking that is happening over it. 该正方形可能会绘制在另一个应用程序窗口上,因此该窗口需要忽略在其上发生的任何单击。 Once the square has been drawn I want to grab the coordinates of where it was drawn and the size of it. 绘制正方形后,我想获取绘制正方形的坐标及其大小。 Then i want to continuously check to see if the image being displayed behind this virtual square changes. 然后,我想连续检查该虚拟方块后面显示的图像是否发生变化。 If it changes I want to force a mouse click in the center of it. 如果更改,我想强制鼠标单击它的中心。 I think I can do the mouse click with mouse_event() in user32.dll. 我想我可以使用user32.dll中的mouse_event()进行鼠标单击。

However, I have not a freaking clue how to do the rest =D 但是,我没有一个奇怪的线索,如何做剩下的= D

Any direction would be awesome... 任何方向都很棒...

All I am looking for here are links to libraries and/or API's. 我在这里寻找的只是库和/或API的链接。 I do not know where to start looking and I am fully capable of reading documentation. 我不知道从哪里开始寻找内容,我完全能够阅读文档。

Using Java, Zoom uses createScreenCapture() to render an enlarged 16 x 16 pixel BufferedImage taken as the mouse is dragged across the screen. 使用Java, Zoom使用createScreenCapture()渲染放大的16 x 16像素的BufferedImage ,这是在将鼠标拖动到屏幕上时获得的。 Once you have the BufferedImage , you can periodically recapture the screen at the same point and use the getRGB() method to compare. 一旦有了BufferedImage ,就可以定期在同一点重新捕获屏幕,并使用getRGB()方法进行比较。 See also Using Timers in Swing Applications . 另请参见在Swing应用程序中使用计时器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM