Search in sources :

Example 1 with PHYSICAL_MONITOR

use of com.sun.jna.platform.win32.PhysicalMonitorEnumerationAPI.PHYSICAL_MONITOR 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());
}
Also used : HMONITOR(com.sun.jna.platform.win32.WinUser.HMONITOR) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference)

Example 2 with PHYSICAL_MONITOR

use of com.sun.jna.platform.win32.PhysicalMonitorEnumerationAPI.PHYSICAL_MONITOR 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);
}
Also used : MONITORINFOEX(com.sun.jna.platform.win32.WinUser.MONITORINFOEX) PHYSICAL_MONITOR(com.sun.jna.platform.win32.PhysicalMonitorEnumerationAPI.PHYSICAL_MONITOR) DWORDByReference(com.sun.jna.platform.win32.WinDef.DWORDByReference) HANDLE(com.sun.jna.platform.win32.WinNT.HANDLE)

Aggregations

DWORDByReference (com.sun.jna.platform.win32.WinDef.DWORDByReference)2 PHYSICAL_MONITOR (com.sun.jna.platform.win32.PhysicalMonitorEnumerationAPI.PHYSICAL_MONITOR)1 HANDLE (com.sun.jna.platform.win32.WinNT.HANDLE)1 HMONITOR (com.sun.jna.platform.win32.WinUser.HMONITOR)1 MONITORINFOEX (com.sun.jna.platform.win32.WinUser.MONITORINFOEX)1