getMonitorDevicePathAt method
Retrieves the unique ID of one of the system's monitors.
Throws a WindowsException on failure.
To learn more, see learn.microsoft.com/windows/win32/api/shobjidl_core/nf-shobjidl_core-idesktopwallpaper-getmonitordevicepathat.
Implementation
PWSTR getMonitorDevicePathAt(int monitorIndex) {
final monitorID = adaptiveCalloc<Pointer<Utf16>>();
final hr$ = HRESULT(
_GetMonitorDevicePathAtFn(ptr, monitorIndex, monitorID),
);
if (hr$.isError) {
free(monitorID);
throw WindowsException(hr$);
}
final result$ = monitorID.value;
free(monitorID);
return PWSTR(result$);
}