Link to home
Start Free TrialLog in
Avatar of mr_mooray
mr_mooray

asked on

Java robot class capturing black/blank desktop images - Help

I am currently capturing various images from the desktop using the robot class. Yet every now and again my program will take a completely black image, which renders my program useless. Does anyone have any suggestion why this is happening ? and what I can do prevent or fix it ?

At the moment I just restart my computer and it seems fine, but I don't want this to happen on my clients computer.

Thanks
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

How are you running the Robot?
Avatar of mr_mooray
mr_mooray

ASKER

     try {
                  Robot robot = new Robot();

                  //capture a screenshot of desktop size
                  Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit()
                              .getScreenSize());
                  BufferedImage capture = robot.createScreenCapture(captureSize);

                  //save to file
                  ImageIO.write(capture, "bmp", new File("C:/Desktop.bmp"));

                  //Set Desktop Image
                  desktopImage = capture;

            } catch (HeadlessException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            } catch (AWTException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
            }
The screensaver hasn't kicked in has it?
No all screen savers are disabled, it just returns a completely black image. I don't think its my code, do you think it could be a different program interfering ?
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
mr_mooray,
This question has been classified as abandoned.  I will make a recommendation to the moderators on its resolution in approximately four days.  I would appreciate any comments by the experts that would help me in making a recommendation.

It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the asker does not know how to close the question, the options are here:
https://www.experts-exchange.com/help.jsp#hs5

girionis
EE Cleanup Volunteer