I found out how to do it. ps. you have to use the full path, that is why it didn't work.
static void Main(string[] args)
{
string photo = @"C:\Users\Wolf\source\repos\wolf\wolf\bin\Debug\FUN.PNG";
DisplayPicture(photo);
}
[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)
{
uint flags = 0;
if (!SystemParametersInfo(SPI_SETDESKWALLPAPER,
0, file_name, flags))
{
Console.WriteLine("Error");
}
}
}
}