updates to mouse commands

Added setTargetOffset, and mouse will move to target window for click,
rightclick and double click
This commit is contained in:
Edward Jakubowski
2014-03-21 01:10:06 -04:00
parent 4f65c0b921
commit 1b33ca6de0
3 changed files with 72 additions and 5 deletions

View File

@@ -130,6 +130,8 @@ public class Api {
boolean IsWindowVisible(HWND hWnd);
int GetWindowRect(HWND hWnd, RECT r);
int MapWindowPoints(HWND hWndFrom, HWND hWndTo, RECT r, int cPoints);
HWND GetDesktopWindow();
HDC GetWindowDC(HWND hWnd);
int ReleaseDC(HWND hWnd, HDC hDC);
boolean InvalidateRect(HWND hWnd, long lpRect, boolean bErase);
@@ -339,6 +341,17 @@ public class Api {
user32.SendMessageA(handle, WM_KEYUP, keyCode, null);
}
public Point getWindowPosition(HWND handle) {
Point windowPoint = new Point();
RECT rect = new RECT();
user32.GetWindowRect(handle, rect);
//System.out.println("rect: l" + rect.left + ",t" + rect.top + ",r" + rect.right + ",b" + rect.bottom);
//user32.MapWindowPoints(user32.GetDesktopWindow(), user32.GetParent(handle), rect, 2);
windowPoint.x = ((rect.right - rect.left) / 2) + rect.left;
windowPoint.y = ((rect.bottom - rect.top) / 2) + rect.top;
return windowPoint;
}
public int getDiskUsedPercentage() {
return getDiskUsedPercentage(null);
}