Take screen shots inside of full screen applicatio

2019-08-20 03:41发布

问题:

I'm using the standard method of taking screenshots using the Java Robot class, i.e.:

BufferedImage screencapture = robot.createScreenCapture(new Rectangle(tool.getScreenSize()));

This works fine most of the time, but it just takes pictures of a blank screen inside of full screen applications (I'm using Windows 7, so most of these are using Direct X for fullscreen). Is this a known problem for the Robot class or am I doing something wrong?

回答1:

The Robot class cannot capture fullscreen DirectX or OpenGL applications.

I just did some quick Google'ing and found JavaCV. It will be a lot more involved than just using Robot, but JavaCV (mainly the OpenCV wrappers) should allow you to do this. (Don't quote me on it though)...