I am trying to create a screen capture program. It has to have three major functions: 1) be able to capture the whole screen. 2) be able to capture the active (current) window 3) be able to capture the desired region (the desired region might be defined by dragging the mouse and draw a box) The first task is very easy to implement with robot class. But how can I implement the second and third task? How can I get the coordinate or dimension of the active window?