In the past I also use SystemParametersInfo this API to change the desktop wallpaper, a lot of problems, do not know which is wrong, did not dig down. After reading Csdn's post, Taichetaiwu ~ ~
Under XP, SystemParametersInfo only supports BMP format picture, if in other format, it will be black screen? (I remember when I was in this situation and now I'm too lazy to test) throw this API's calling method out:
SystemParametersInfo (spi_setdeskwallpaper, 1, Pointer (Pchar (' c:\a.bmp ')), 0);
Because of the limitations of this API function
Uses Shlobj, comobj;
Procedure Setwp (wp:string);
Var
Hobj:iunknown;
Adesktop:iactivedesktop;
Begin
Hobj: = Createcomobject (Clsid_activedesktop);
Adesktop: = Hobj as IActiveDesktop;
Adesktop.setwallpaper (Pwidechar (widestring (WP)), 0);
Adesktop.applychanges (Ad_apply_all or ad_apply_force);?
End
Calling methods
Setwp (' C:\1.jpg ');
Note: Because a COM object is called, you need to initialize the COM library
If you do not reference a cell like dialogs, you need to call CoInitialize () manually and then release the object when you exit
Uses ActiveX;
Initialization
CoInitialize (nil);
Finalization
CoUninitialize;
Http://www.lsworks.net/article/29.html
Delphi Changes desktop wallpaper by calling COM objects