use of com.sun.jna.platform.win32.WinUser.MONITORINFOEX in project jna by java-native-access.
the class User32Test method testGetMonitorInfo.
@Test
public final void testGetMonitorInfo() {
HMONITOR hMon = User32.INSTANCE.MonitorFromWindow(User32.INSTANCE.GetDesktopWindow(), WinUser.MONITOR_DEFAULTTOPRIMARY);
assertTrue(User32.INSTANCE.GetMonitorInfo(hMon, new MONITORINFO()).booleanValue());
assertTrue(User32.INSTANCE.GetMonitorInfo(hMon, new MONITORINFOEX()).booleanValue());
}
use of com.sun.jna.platform.win32.WinUser.MONITORINFOEX in project jna by java-native-access.
the class MonitorInfoDemo method enumerate.
static void enumerate(HMONITOR hMonitor) {
System.out.println("Found HMONITOR: " + hMonitor.getPointer().toString());
MONITORINFOEX info = new MONITORINFOEX();
User32.INSTANCE.GetMonitorInfo(hMonitor, info);
System.out.println("Screen " + info.rcMonitor);
System.out.println("Work area " + info.rcWork);
boolean isPrimary = (info.dwFlags & WinUser.MONITORINFOF_PRIMARY) != 0;
System.out.println("Primary? " + (isPrimary ? "yes" : "no"));
System.out.println("Device " + new String(info.szDevice));
DWORDByReference pdwNumberOfPhysicalMonitors = new DWORDByReference();
Dxva2.INSTANCE.GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, pdwNumberOfPhysicalMonitors);
int monitorCount = pdwNumberOfPhysicalMonitors.getValue().intValue();
System.out.println("HMONITOR is linked to " + monitorCount + " physical monitors");
PHYSICAL_MONITOR[] physMons = new PHYSICAL_MONITOR[monitorCount];
Dxva2.INSTANCE.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, physMons);
for (int i = 0; i < monitorCount; i++) {
HANDLE hPhysicalMonitor = physMons[0].hPhysicalMonitor;
System.out.println("Monitor " + i + " - " + new String(physMons[i].szPhysicalMonitorDescription));
enumeratePhysicalMonitor(hPhysicalMonitor);
}
Dxva2.INSTANCE.DestroyPhysicalMonitors(monitorCount, physMons);
}
Aggregations