Change desktop background in C# -


i try change background using c#.example:

[dllimport("user32.dll", charset = charset.auto)]     private static extern int32 systemparametersinfo(uint32 uiaction, uint32     uiparam, string pvparam, uint32 fwinini);     private static uint32 spi_setdeskwallpaper = 20;     private static uint32 spif_updateinifile = 0x1; 

and then

  systemparametersinfo(spi_setdeskwallpaper, 1, @"c:\background.bmp", spif_updateinifile);                             } 

but doesn't work...help?

pvparam should local file. not work urls...

first download image, give local path systemparametersinfo method.

var filename = "4.jpg"; new webclient().downloadfile("http://www.scottgames.com/4.jpg", filename); systemparametersinfo(spi_setdeskwallpaper, 1, filename, spif_updateinifile); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -