use of com.sun.jna.platform.DesktopWindow in project jna by java-native-access.
the class User32Test method testSendMessage.
@Test
public void testSendMessage() {
DesktopWindow explorerProc = getWindowByProcessPath("explorer.exe");
assertNotNull(explorerProc);
LRESULT result = User32.INSTANCE.SendMessage(explorerProc.getHWND(), WinUser.WM_USER, new WPARAM(124), new LPARAM(12345));
assertNotEquals(0, result);
}
use of com.sun.jna.platform.DesktopWindow in project jna by java-native-access.
the class User32Test method testSendMessageTimeout.
@Test
public void testSendMessageTimeout() {
DesktopWindow explorerProc = getWindowByProcessPath("explorer.exe");
assertNotNull(explorerProc);
final DWORDByReference hIconNumber = new DWORDByReference();
LRESULT result = User32.INSTANCE.SendMessageTimeout(explorerProc.getHWND(), WinUser.WM_GETICON, new WPARAM(WinUser.ICON_BIG), new LPARAM(0), WinUser.SMTO_ABORTIFHUNG, 500, hIconNumber);
assertNotEquals(0, result);
}
use of com.sun.jna.platform.DesktopWindow 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.DesktopWindow in project jna by java-native-access.
the class WindowUtilsTest method testGetAllWindows.
public void testGetAllWindows() {
final List<DesktopWindow> allWindows = WindowUtils.getAllWindows(false);
final List<DesktopWindow> allVisibleWindows = WindowUtils.getAllWindows(true);
assertTrue("Found no windows", allWindows.size() > 0);
assertTrue("Found no visible windows", allVisibleWindows.size() > 0);
assertTrue("Expected more non-visible windows than visible windows", allWindows.size() > allVisibleWindows.size());
DesktopWindow explorerProc = null;
for (final DesktopWindow dw : allWindows) {
if (dw.getFilePath().toLowerCase().endsWith("explorer.exe")) {
explorerProc = dw;
break;
}
}
assertNotNull("explorer.exe was not found among all windows", explorerProc);
explorerProc = null;
for (final DesktopWindow dw : allVisibleWindows) {
if (dw.getFilePath().toLowerCase().endsWith("explorer.exe")) {
explorerProc = dw;
break;
}
}
assertNotNull("explorer.exe was not found among visible windows", explorerProc);
}
Aggregations