c# - Change Desktop Wallpaper using a Jpeg file -
I am trying to write a simple program to replace my desktop wallpaper. I am using a downloaded JPEG file and I would like to convert it to code. The problem is that bitmap needs to display 24 bits. How do I do this? thank you in advanced. Public class ChangeWallpaper {[DllImport ("user32.dll", Charset = Charset.auto)] Stable extern int system ParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni); Public Stable Zero Main () {bitmap wallbm = new bitmap ("pic.jpg"); Wallbm.Save ("pic.bmp"); SystemParametersInfo (20, 0, "pic.bmp", 0x01 | 0x02); }}
I could not work for a clone for some reason. I was able to work with trial and error using the following code:
public class ChangeWallpaper {[DllImport ("user32.dll", chartset = charset.auto)] steady extern int System ParametersInfo (IntuAuction, Intuperateum, String LPVPerm, Int FuWinini); Public Stable Zero Main () {bitmap BM = new bitmap (Image.FromFile ("pic.jpg")); BM. Save ("pic.bmp", imageform.bmp); SystemParametersInfo (20, 0, "pic.bmp", 0x01 | 0x02); }}
Comments
Post a Comment