Forum > Coding >

[RELEASE] C# Change Wallpaper Code

http0x22

absolute n word

Posts: 6

Threads: 2

Joined: Oct, 2022

Reputation: 0

Posted

Button Code:
var filename = "your image name.png";
//dowload file
new WebClient().DownloadFile("here put your image link, i'd prefer uploading image to discord and copying the image link here", filename);
//get current path
string path = AppDomain.CurrentDomain.BaseDirectory;
//call function changeWallpaper
changeWallpaper(path + filename);

Change Wallpaper Function + The Requirements:
//set infomation for image
const int SPI_SETDESKWALLPAPER = 20;
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDWININICHANGE = 0x02;

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);

//function change wallpapers
static void changeWallpaper(string filename)
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 1, filename, SPIF_UPDATEINIFILE);
}

Video Tutorial: VIDEO
  • 0

https://i.imgur.com/aEcB6i1.gif

https://cdn.discordapp.com/attachments/915611545965310005/1037814100568330320/h92wrdkqzi171.jpeg

penis

blueless

Failed to fetch.

vip

Posts: 325

Threads: 35

Joined: Dec, 2021

Reputation: 15

Replied

Good job though?

  • 0

Failed to fetch.

Posts: 5

Threads: 0

Joined: Apr, 2022

Reputation: 0

Replied

I found everything very good. Functions all enter their orbits very precisely .

  • 0

TERIHAX

i say im gay as a joke 🙀

Posts: 1789

Threads: 92

Joined: Jul, 2020

Reputation: 30

Replied

@lopezmason bro did you use like yandex translate to get that

  • 0

Added

bro use a using statement for the webclient or else memory leaks

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )