private static string MonitorFriendlyName(LUID adapterId, uint targetId) { var deviceName = new DISPLAYCONFIG_TARGET_DEVICE_NAME { header = { size = (uint)Marshal.SizeOf(typeof (DISPLAYCONFIG_TARGET_DEVICE_NAME)), adapterId = adapterId, id = targetId, type = DISPLAYCONFIG_DEVICE_INFO_TYPE.DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME } }; var error = DisplayConfigGetDeviceInfo(ref deviceName); if (error != ERROR_SUCCESS) throw new Win32Exception(error); return deviceName.monitorFriendlyDeviceName; }
public static extern int DisplayConfigGetDeviceInfo(ref DISPLAYCONFIG_TARGET_DEVICE_NAME requestPacket);
public static extern int DisplayConfigGetDeviceInfo(ref DISPLAYCONFIG_TARGET_DEVICE_NAME deviceName);