I'm willing to fix an application i made. Basically, it sets the desktop wallpaper on windows (i'm on Win10). The only issue is when Windows restarts the wallpaper is gone and it's just black. I'm no expert and I found this code online. I'm wondering if some of you could know how to fix that.
C#:
//inside Form1: Form
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SystemParametersInfo(uint uiAction, uint uiParam, String pvParam, uint fWinIni);
private const uint SPI_SETDESKWALLPAPER = 0x14;
private const uint SPIF_UPDATEINIFILE = 0x1;
private const uint SPIF_SENDWININICHANGE = 0x2;
private static void DisplayPicture(string file_name)//the string is the file path you want
{
uint flags = 0;
if (!SystemParametersInfo(SPI_SETDESKWALLPAPER,
0, file_name, flags))
{
Console.WriteLine("Error");
}
}