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!

Changing desktop wallpaper 1

Status
Not open for further replies.

donvittorio

Programmer
Jul 17, 2003
122
GB
Hi,

I'm writing a little program to change the desktop wallpaper on a Win 2000 machine. I am changing the registry settings for stretch, tile and centre okay and I'm using SystemParametersInfo to set the wallpaper okay using the following line
Code:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Pointer(Filename), SPIF_UPDATEINIFILE)
but the change is not applied immediately. To get the change to actually appear on screen then I have to go into the desktop properties dialog screen and apply the change manually (or reboot the machine).
Does anybody know how to apply the change so that it is effective immediately?

Thanks

Steve
 
Ah-ha, I've found the answer. I need to change the last parameter to be SPIF_UPDATEINIFILE or SPIF_SENDWININICHANGE, i.e.
Code:
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Pointer(Filename), SPIF_UPDATEINIFILE or SPIF_SENDWININICHANGE)
and then the change is applied.
 
Nice to posting a answer even when you solved it by yourself!!!

-----------------------------------------------------
-"There is always a different way to solve it"

//Nordlund
 
Nordlund, true but I hope it was you that awarded the Star?


Steve
Be excellent to each other and Party on!
 
I hope you guys weren't suggesting that I awarded myself a star.
Hang on a minute, can you do that? That gives me an idea...
 
I think Nordlund's fishing for a star!!! [wink]

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
I don't think you can give your self a star. I don't have the 'Thank lespaul for this valuable post' on MY posts!

Leslie
 
You are right Leslie, you definitely cannot give yourself a star!

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Here I am again...
All of us here want a star otherwise this conversation would end right after Don's answer to himself.... ;-)

I like people who does like Don did... I do the same thing myself....

-----------------------------------------------------
-"There is always a different way to solve it"

//Nordlund
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top