Mega Code Archive

 
Categories / Delphi / API
 

Changing the windows wallpaper in code

Question: How do I change the Windows wallpaper in code? Answer: Call the Windows API function SystemParametersInfo() passing the SPI_SETDESKWALLPAPER parameter along with the filename of the new bitmap to use. Example: SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, PChar('C:\SOMEPATH\SOME.BMP'), SPIF_SENDWININICHANGE);