Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Wallpaper??? 2

Status
Not open for further replies.

Gert

Programmer
Apr 9, 2000
240
DO
Hi all,

could be some API call that let me change the windows desktop background(wallpaper).
 
Gert


The Wallpaper is specified in the registry. Find the reference to it and change via registry access (Making sure that the one you want to change it to is available on the client's system).

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Gert,

Here is the API you need. It will update the registry & ini file automatically, and refresh the desktop immediately

Declare Long SystemParametersInfo in User32 ;
Long nAction, Long nParam, ;
String lpParam, Long lWinIni

cWallPaper = 'WallPaper.BMP'
SystemParametersInfo(20, 0, cWallPaper, .T.)


-- AirCon --
 
Gert,
As Mike suggests, it's in the Reigstry - you can get it with this .PRG.
Code:
*GETWPFILE.PRG
#DEFINE HKEY_CURRENT_USER  -2147483647  && BITSET(0,31)+1

LOCAL lcRegValue, lcRegfile, lnRetVal, oReg

lcRegValue = ""
lcRegfile = "REGISTRY"
lnRetVal = 0

SET PROCEDURE TO (m.lcRegfile) ADDITIVE
oReg = CreateObject("Registry")

lnRetVal = oReg.GetRegKey("Wallpaper",@lcRegValue,;
    "Control Panel\desktop", HKEY_CURRENT_USER)

RELEASE oReg
RELEASE PROC (m.lcRegfile)

RETURN iif(lnRetVal = 0, lcRegValue, "Couldn't Find")
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top