I have a code snippet to set a single image across both monitors but I recently got a second monitor for my laptop and I wanted to modify my code to account for setting a diffrent image to each monitor.
Any ideas?
(this code snipet for single monitor is:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SystemParametersInfo(UInt32 action, UInt32 uParam, String vParam, UInt32 winIni);
private static readonly UInt32 SPI_SETDESKWALLPAPER = 0x14;
private static readonly UInt32 SPIF_UPDATEINIFILE = 0x01;
private static readonly UInt32 SPIF_SENDWININICHANGE = 0x02;
private void SetWallpaper(string path)
{
if (path != null)
{
string savepath = Settings.Default.SavePath;
Image imgInFile = Image.FromFile(path);
imgInFile.Save(savepath, ImageFormat.Bmp);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 3, savepath, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
}
else
{
MessageBox.Show("Path Null");
}
}
)