0

This code works in windows 7, but does not work in the windows 10. Instead of changing the wallpaper just black screen

[DllImport("User32", CharSet = CharSet.Auto)]
    public static extern int SystemParametersInfo(int uiAction, int uiParam,
        string pvParam, uint fWinIni);
    static void Main(string[] args)
    {
        SystemParametersInfo(0x0014, 0, "Image.jpg", 0x0001);
    }
d65u
  • 29
  • 1
  • 4

1 Answers1

6

Instead of only passing Image.jpg, use the full path:

SystemParametersInfo(0x0014, 0, "C:\\Image.jpg", 0x0001);
magicandre1981
  • 27,895
  • 5
  • 86
  • 127