Skip to content

Commit

Permalink
fix: Fix the program cannot start when copying the desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
Light authored and Light committed Nov 11, 2022
1 parent 023370b commit f9cb817
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions MultiMonitorWallpaperSwitcher/Monitor/MonitorProc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public static List<MonitorItem> GetMonitorItems()
var wallpaper = (IDesktopWallpaper)(new DesktopWallpaperClass());
for (uint i = 0; i < wallpaper.GetMonitorDevicePathCount(); i++)
{
var monitorId = wallpaper.GetMonitorDevicePathAt(i);
var rect = wallpaper.GetMonitorRECT(monitorId);
list.Add(new MonitorItem(monitorId, rect));
try
{
var monitorId = wallpaper.GetMonitorDevicePathAt(i);
var rect = wallpaper.GetMonitorRECT(monitorId);
list.Add(new MonitorItem(monitorId, rect));
}
catch { }
}
return list;
}
Expand Down

0 comments on commit f9cb817

Please sign in to comment.