Java Code Examples for com.sun.jna.platform.win32.WinDef.RECT#toRectangle()

The following examples show how to use com.sun.jna.platform.win32.WinDef.RECT#toRectangle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WinUtil.java    From SikuliX1 with MIT License 5 votes vote down vote up
@Override
public Rectangle getFocusedWindow() {
  HWND hwnd = user32.GetForegroundWindow();
  RECT rect = new User32.RECT();
  boolean success = user32.GetWindowRect(hwnd, rect);
  return success ? rect.toRectangle() : null;
  //return getFocusedRectangle();
}
 
Example 2
Source File: WinUtil.java    From SikuliX1 with MIT License 4 votes vote down vote up
private static Rectangle getRectangle(HWND hwnd, int winNum) {
  RECT rect = new User32.RECT();
  boolean success = user32.GetWindowRect(hwnd, rect);
  return success ? rect.toRectangle() : null;
}