` Changing the desktop wallpaper (Arnor Baldvinsson) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Windows API: Changing the desktop wallpaper
2004-07-04 -- Arnor Baldvinsson
 
Newsgroups: comp.lang.clarion >Using C5.5 , any one know under program code to take a picture image user >selected from a form image control and force it tobe now the new windows >background for their desktop. How can this be done., does this mean trying >to address windows registeries as well? This should work: Map Module('win32.lib') SystemParametersInfo(ULONG, ULONG, ULONG,ULONG),BOOL,PASCAL,RAW End End SPI_SETDESKWALLPAPER EQUATE(00014H) SPIF_UPDATEINIFILE EQUATE(00001H) SPIF_SENDWININICHANGE EQUATE(00002H) SPIF_SENDCHANGE EQUATE(SPIF_SENDWININICHANGE) ImageLocation CString(1024) Code ImageLocation = 'whatever.bmp' SystemParametersInfo(SPI_SETDESKWALLPAPER,| 0,| Address(ImageLocation),| SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE) I found this for VB 2005: http://www.devx.com/tips/Tip/21380 It uses this option in the SystemParametersInfo api call to change the desktop wallpaper. This is NOT tested and the equates below are created from the C #defines using search+replace and have not been tested. Here are the available SPI_ and SPIF_ equates: /* * Parameter for SystemParametersInfo() */ SPI_GETBEEP EQUATE(00001H) SPI_SETBEEP EQUATE(00002H) SPI_GETMOUSE EQUATE(00003H) SPI_SETMOUSE EQUATE(00004H) SPI_GETBORDER EQUATE(00005H) SPI_SETBORDER EQUATE(00006H) SPI_GETKEYBOARDSPEED EQUATE(0000AH) SPI_SETKEYBOARDSPEED EQUATE(0000BH) SPI_LANGDRIVER EQUATE(0000CH) SPI_ICONHORIZONTALSPACING EQUATE(0000DH) SPI_GETSCREENSAVETIMEOUT EQUATE(0000EH) SPI_SETSCREENSAVETIMEOUT EQUATE(0000FH) SPI_GETSCREENSAVEACTIVE EQUATE(00010H) SPI_SETSCREENSAVEACTIVE EQUATE(00011H) SPI_GETGRIDGRANULARITY EQUATE(00012H) SPI_SETGRIDGRANULARITY EQUATE(00013H) SPI_SETDESKWALLPAPER EQUATE(00014H) SPI_SETDESKPATTERN EQUATE(00015H) SPI_GETKEYBOARDDELAY EQUATE(00016H) SPI_SETKEYBOARDDELAY EQUATE(00017H) SPI_ICONVERTICALSPACING EQUATE(00018H) SPI_GETICONTITLEWRAP EQUATE(00019H) SPI_SETICONTITLEWRAP EQUATE(0001AH) SPI_GETMENUDROPALIGNMENT EQUATE(0001BH) SPI_SETMENUDROPALIGNMENT EQUATE(0001CH) SPI_SETDOUBLECLKWIDTH EQUATE(0001DH) SPI_SETDOUBLECLKHEIGHT EQUATE(0001EH) SPI_GETICONTITLELOGFONT EQUATE(0001FH) SPI_SETDOUBLECLICKTIME EQUATE(00020H) SPI_SETMOUSEBUTTONSWAP EQUATE(00021H) SPI_SETICONTITLELOGFONT EQUATE(00022H) SPI_GETFASTTASKSWITCH EQUATE(00023H) SPI_SETFASTTASKSWITCH EQUATE(00024H) !!#if(WINVER >= EQUATE(00400h) SPI_SETDRAGFULLWINDOWS EQUATE(00025H) SPI_GETDRAGFULLWINDOWS EQUATE(00026H) SPI_GETNONCLIENTMETRICS EQUATE(00029H) SPI_SETNONCLIENTMETRICS EQUATE(0002AH) SPI_GETMINIMIZEDMETRICS EQUATE(0002BH) SPI_SETMINIMIZEDMETRICS EQUATE(0002CH) SPI_GETICONMETRICS EQUATE(0002DH) SPI_SETICONMETRICS EQUATE(0002EH) SPI_SETWORKAREA EQUATE(0002FH) SPI_GETWORKAREA EQUATE(00030H) SPI_SETPENWINDOWS EQUATE(00031H) SPI_GETHIGHCONTRAST EQUATE(00042H) SPI_SETHIGHCONTRAST EQUATE(00043H) SPI_GETKEYBOARDPREF EQUATE(00044H) SPI_SETKEYBOARDPREF EQUATE(00045H) SPI_GETSCREENREADER EQUATE(00046H) SPI_SETSCREENREADER EQUATE(00047H) SPI_GETANIMATION EQUATE(00048H) SPI_SETANIMATION EQUATE(00049H) SPI_GETFONTSMOOTHING EQUATE(0004AH) SPI_SETFONTSMOOTHING EQUATE(0004BH) SPI_SETDRAGWIDTH EQUATE(0004CH) SPI_SETDRAGHEIGHT EQUATE(0004DH) SPI_SETHANDHELD EQUATE(0004EH) SPI_GETLOWPOWERTIMEOUT EQUATE(0004FH) SPI_GETPOWEROFFTIMEOUT EQUATE(00050H) SPI_SETLOWPOWERTIMEOUT EQUATE(00051H) SPI_SETPOWEROFFTIMEOUT EQUATE(00052H) SPI_GETLOWPOWERACTIVE EQUATE(00053H) SPI_GETPOWEROFFACTIVE EQUATE(00054H) SPI_SETLOWPOWERACTIVE EQUATE(00055H) SPI_SETPOWEROFFACTIVE EQUATE(00056H) SPI_SETCURSORS EQUATE(00057H) SPI_SETICONS EQUATE(00058H) SPI_GETDEFAULTINPUTLANG EQUATE(00059H) SPI_SETDEFAULTINPUTLANG EQUATE(0005AH) SPI_SETLANGTOGGLE EQUATE(0005BH) SPI_GETWINDOWSEXTENSION EQUATE(0005CH) SPI_SETMOUSETRAILS EQUATE(0005DH) SPI_GETMOUSETRAILS EQUATE(0005EH) SPI_SETSCREENSAVERRUNNING EQUATE(00061H) SPI_SCREENSAVERRUNNING EQUATE(SPI_SETSCREENSAVERRUNNING) !!#endif /* WINVER >= EQUATE(00400h) */ SPI_GETFILTERKEYS EQUATE(00032H) SPI_SETFILTERKEYS EQUATE(00033H) SPI_GETTOGGLEKEYS EQUATE(00034H) SPI_SETTOGGLEKEYS EQUATE(00035H) SPI_GETMOUSEKEYS EQUATE(00036H) SPI_SETMOUSEKEYS EQUATE(00037H) SPI_GETSHOWSOUNDS EQUATE(00038H) SPI_SETSHOWSOUNDS EQUATE(00039H) SPI_GETSTICKYKEYS EQUATE(0003AH) SPI_SETSTICKYKEYS EQUATE(0003BH) SPI_GETACCESSTIMEOUT EQUATE(0003CH) SPI_SETACCESSTIMEOUT EQUATE(0003DH) !!#if(WINVER >= EQUATE(00400H) SPI_GETSERIALKEYS EQUATE(0003EH) SPI_SETSERIALKEYS EQUATE(0003FH) !!#endif /* WINVER >= EQUATE(00400h */ SPI_GETSOUNDSENTRY EQUATE(00040H) SPI_SETSOUNDSENTRY EQUATE(00041H) !!#if(_WIN32_WINNT >= EQUATE(00400h) SPI_GETSNAPTODEFBUTTON EQUATE(0005FH) SPI_SETSNAPTODEFBUTTON EQUATE(00060H) !!#endif /* _WIN32_WINNT >= EQUATE(00400h) */ !!#if (_WIN32_WINNT >= EQUATE(00400h) || (_WIN32_WINDOWS > EQUATE(00400H) SPI_GETMOUSEHOVERWIDTH EQUATE(00062H) SPI_SETMOUSEHOVERWIDTH EQUATE(00063H) SPI_GETMOUSEHOVERHEIGHT EQUATE(00064H) SPI_SETMOUSEHOVERHEIGHT EQUATE(00065H) SPI_GETMOUSEHOVERTIME EQUATE(00066H) SPI_SETMOUSEHOVERTIME EQUATE(00067H) SPI_GETWHEELSCROLLLINES EQUATE(00068H) SPI_SETWHEELSCROLLLINES EQUATE(00069H) SPI_GETMENUSHOWDELAY EQUATE(0006AH) SPI_SETMENUSHOWDELAY EQUATE(0006BH) SPI_GETSHOWIMEUI EQUATE(0006EH) SPI_SETSHOWIMEUI EQUATE(0006FH) !!#endif #if(WINVER >= EQUATE(00500H) SPI_GETMOUSESPEED EQUATE(00070H) SPI_SETMOUSESPEED EQUATE(00071H) SPI_GETSCREENSAVERRUNNING EQUATE(00072H) SPI_GETDESKWALLPAPER EQUATE(00073H) !!#endif /* WINVER >= EQUATE(00500h */ #if(WINVER >= EQUATE(00500H) SPI_GETACTIVEWINDOWTRACKING EQUATE(01000H) SPI_SETACTIVEWINDOWTRACKING EQUATE(01001H) SPI_GETMENUANIMATION EQUATE(01002H) SPI_SETMENUANIMATION EQUATE(01003H) SPI_GETCOMBOBOXANIMATION EQUATE(01004H) SPI_SETCOMBOBOXANIMATION EQUATE(01005H) SPI_GETLISTBOXSMOOTHSCROLLING EQUATE(01006H) SPI_SETLISTBOXSMOOTHSCROLLING EQUATE(01007H) SPI_GETGRADIENTCAPTIONS EQUATE(01008H) SPI_SETGRADIENTCAPTIONS EQUATE(01009H) SPI_GETKEYBOARDCUES EQUATE(0100AH) SPI_SETKEYBOARDCUES EQUATE(0100BH) SPI_GETMENUUNDERLINES EQUATE(SPI_GETKEYBOARDCUES) SPI_SETMENUUNDERLINES EQUATE(SPI_SETKEYBOARDCUES) SPI_GETACTIVEWNDTRKZORDER EQUATE(0100CH) SPI_SETACTIVEWNDTRKZORDER EQUATE(0100DH) SPI_GETHOTTRACKING EQUATE(0100EH) SPI_SETHOTTRACKING EQUATE(0100FH) SPI_GETMENUFADE EQUATE(01012H) SPI_SETMENUFADE EQUATE(01013H) SPI_GETSELECTIONFADE EQUATE(01014H) SPI_SETSELECTIONFADE EQUATE(01015H) SPI_GETTOOLTIPANIMATION EQUATE(01016H) SPI_SETTOOLTIPANIMATION EQUATE(01017H) SPI_GETTOOLTIPFADE EQUATE(01018H) SPI_SETTOOLTIPFADE EQUATE(01019H) SPI_GETCURSORSHADOW EQUATE(0101AH) SPI_SETCURSORSHADOW EQUATE(0101BH) !! #if(_WIN32_WINNT >= EQUATE(00501) SPI_GETMOUSESONAR EQUATE(0101CH) SPI_SETMOUSESONAR EQUATE(0101DH) SPI_GETMOUSECLICKLOCK EQUATE(0101EH) SPI_SETMOUSECLICKLOCK EQUATE(0101FH) SPI_GETMOUSEVANISH EQUATE(01020H) SPI_SETMOUSEVANISH EQUATE(01021H) SPI_GETFLATMENU EQUATE(01022H) SPI_SETFLATMENU EQUATE(01023H) SPI_GETDROPSHADOW EQUATE(01024H) SPI_SETDROPSHADOW EQUATE(01025H) SPI_GETBLOCKSENDINPUTRESETS EQUATE(01026H) SPI_SETBLOCKSENDINPUTRESETS EQUATE(01027H) !! #endif /* _WIN32_WINNT >= 00501h */) SPI_GETUIEFFECTS EQUATE(0103EH) SPI_SETUIEFFECTS EQUATE(0103FH) SPI_GETFOREGROUNDLOCKTIMEOUT EQUATE(02000H) SPI_SETFOREGROUNDLOCKTIMEOUT EQUATE(02001H) SPI_GETACTIVEWNDTRKTIMEOUT EQUATE(02002H) SPI_SETACTIVEWNDTRKTIMEOUT EQUATE(02003H) SPI_GETFOREGROUNDFLASHCOUNT EQUATE(02004H) SPI_SETFOREGROUNDFLASHCOUNT EQUATE(02005H) SPI_GETCARETWIDTH EQUATE(02006H) SPI_SETCARETWIDTH EQUATE(02007H) !!#if(_WIN32_WINNT >= 00501h) SPI_GETMOUSECLICKLOCKTIME EQUATE(02008H) SPI_SETMOUSECLICKLOCKTIME EQUATE(02009H) SPI_GETFONTSMOOTHINGTYPE EQUATE(0200AH) SPI_SETFONTSMOOTHINGTYPE EQUATE(0200BH) !!/* constants for SPI_GETFONTSMOOTHINGTYPE and SPI_SETFONTSMOOTHINGTYPE: */ FE_FONTSMOOTHINGSTANDARD EQUATE(00001H) FE_FONTSMOOTHINGCLEARTYPE EQUATE(00002H) FE_FONTSMOOTHINGDOCKING EQUATE(08000H) SPI_GETFONTSMOOTHINGCONTRAST EQUATE(0200CH) SPI_SETFONTSMOOTHINGCONTRAST EQUATE(0200DH) SPI_GETFOCUSBORDERWIDTH EQUATE(0200EH) SPI_SETFOCUSBORDERWIDTH EQUATE(0200FH) SPI_GETFOCUSBORDERHEIGHT EQUATE(02010H) SPI_SETFOCUSBORDERHEIGHT EQUATE(02011H) SPI_GETFONTSMOOTHINGORIENTATION EQUATE(02012H) SPI_SETFONTSMOOTHINGORIENTATION EQUATE(02013H) !!/* constants for SPI_GETFONTSMOOTHINGORIENTATION and SPI_SETFONTSMOOTHINGORIENTATION: */ FE_FONTSMOOTHINGORIENTATIONBGR EQUATE(00000H) FE_FONTSMOOTHINGORIENTATIONRGB EQUATE(00001H) !!#endif /* _WIN32_WINNT >= 00501h */ !!#endif /* WINVER >= 00500h */ !/* ! * Flags ! */ SPIF_UPDATEINIFILE EQUATE(00001H) SPIF_SENDWININICHANGE EQUATE(00002H) SPIF_SENDCHANGE EQUATE(SPIF_SENDWININICHANGE) Here are some more links: This is the google search link: Google search And some of the results: http://support.microsoft.com/default.aspx?scid=kb;EN-US;97142 http://www.mcse.ms/printthread.php?threadid=712060 http://community.borland.com/article/0,1410,29037,00.html http://www.latiumsoftware.com/en/delphi/00020.php http://www.vb-helper.com/howto_backer.html That last one shows that JPG and GIF images are saved to BMP before using with the SPI. Also you should update the registry with the wallpaper name (see one of the delphi links or the next one) http://www.freevbcode.com/ShowCode.asp?ID=332 Now you see, ALL this information is at your fingertips when you go to www.google.com I haven't written a single line of code to help you out and I have never used this - yet All I did was spend about a minute total on google to find the right code:) Best regards, ArnĂ³r Baldvinsson Icetips Software San Antonio, Texas, USA www.icetips.com arnor@icetips.com Subscribe to information from Icetips.com: http://www.icetips.com/subscribe.php


Today is November 21, 2024, 3:50 am
This article has been viewed 35379 times.
Google search has resulted in 564 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: