use of com.sun.jna.platform.win32.User32 in project jna by java-native-access.
the class Shell32Test method testResizeDesktopFromTop.
public void testResizeDesktopFromTop() throws InterruptedException {
newAppBar();
APPBARDATA data = new APPBARDATA.ByReference();
data.uEdge.setValue(ShellAPI.ABE_TOP);
data.rc.top = 0;
data.rc.left = 0;
data.rc.bottom = User32.INSTANCE.GetSystemMetrics(User32.SM_CXFULLSCREEN) - RESIZE_DELTA;
data.rc.right = User32.INSTANCE.GetSystemMetrics(User32.SM_CXFULLSCREEN);
queryPos(data);
UINT_PTR h = Shell32.INSTANCE.SHAppBarMessage(new DWORD(ShellAPI.ABM_SETPOS), data);
assertNotNull(h);
assertTrue(h.intValue() >= 0);
removeAppBar();
}
use of com.sun.jna.platform.win32.User32 in project jna by java-native-access.
the class User32Test method testGetClassLongPtr.
@Test
public void testGetClassLongPtr() {
if (System.getProperty("os.arch", "unknown").equalsIgnoreCase("amd64")) {
DesktopWindow explorerProc = getWindowByProcessPath("explorer.exe");
assertNotNull("Could not find explorer.exe process", explorerProc);
ULONG_PTR result = User32.INSTANCE.GetClassLongPtr(explorerProc.getHWND(), WinUser.GCLP_HMODULE);
assertNotEquals(0, result.intValue());
} else {
System.err.println("GetClassLongPtr only supported on x64");
}
}
use of com.sun.jna.platform.win32.User32 in project jna by java-native-access.
the class User32Test method testGetCursorPos.
@Test
public void testGetCursorPos() {
POINT cursorPos = new POINT();
boolean result = User32.INSTANCE.GetCursorPos(cursorPos);
assertTrue("GetCursorPos should return true", result);
assertTrue("X coordinate in POINT should be >= 0", cursorPos.x >= 0);
assertTrue("Y coordinate in POINT should be >= 0", cursorPos.y >= 0);
}
use of com.sun.jna.platform.win32.User32 in project jna by java-native-access.
the class User32Test method testSetCursorPos.
@Test
public void testSetCursorPos() {
POINT cursorPos = new POINT();
boolean result = User32.INSTANCE.GetCursorPos(cursorPos);
assertTrue("GetCursorPos should return true", result);
assertTrue("X coordinate in POINT should be >= 0", cursorPos.x >= 0);
boolean scpResult = User32.INSTANCE.SetCursorPos(cursorPos.x - 20, cursorPos.y);
assertTrue("SetCursorPos should return true", scpResult);
POINT cursorPos2 = new POINT();
boolean result2 = User32.INSTANCE.GetCursorPos(cursorPos2);
assertTrue("GetCursorPos should return true", result2);
assertTrue("X coordinate in POINT should be original cursor position - 20", cursorPos2.x == cursorPos.x - 20);
}
use of com.sun.jna.platform.win32.User32 in project jna by java-native-access.
the class User32Test method testAdjustWindowRect.
@Test
public final void testAdjustWindowRect() {
RECT lpRect = new RECT();
lpRect.left = 100;
lpRect.top = 200;
lpRect.bottom = 300;
lpRect.right = 500;
assertTrue(User32.INSTANCE.AdjustWindowRect(lpRect, new DWORD(WinUser.WS_THICKFRAME), new BOOL(1)).booleanValue());
assertTrue(lpRect.left < 100);
assertTrue(lpRect.top < 200);
assertTrue(lpRect.bottom > 300);
assertTrue(lpRect.right > 500);
}
Aggregations