use of com.sun.jna.platform.win32.WinUser.HMONITOR 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.HMONITOR in project jna by java-native-access.
the class Dxva2Test method setUp.
@Before
public void setUp() {
HMONITOR hMonitor = User32.INSTANCE.MonitorFromWindow(User32.INSTANCE.GetDesktopWindow(), WinUser.MONITOR_DEFAULTTOPRIMARY);
DWORDByReference pdwNumberOfPhysicalMonitors = new DWORDByReference();
assertTrue(Dxva2.INSTANCE.GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, pdwNumberOfPhysicalMonitors).booleanValue());
monitorCount = pdwNumberOfPhysicalMonitors.getValue().intValue();
physMons = new PHYSICAL_MONITOR[monitorCount];
assumeTrue(Dxva2.INSTANCE.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, physMons).booleanValue());
}
use of com.sun.jna.platform.win32.WinUser.HMONITOR in project jna by java-native-access.
the class MonitorInfoDemo method main.
/**
* @param args (ignored)
*/
public static void main(String[] args) {
System.out.println("Installed Physical Monitors: " + User32.INSTANCE.GetSystemMetrics(WinUser.SM_CMONITORS));
User32.INSTANCE.EnumDisplayMonitors(null, null, new MONITORENUMPROC() {
@Override
public int apply(HMONITOR hMonitor, HDC hdc, RECT rect, LPARAM lparam) {
enumerate(hMonitor);
return 1;
}
}, new LPARAM(0));
}
use of com.sun.jna.platform.win32.WinUser.HMONITOR 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