Page 1 of 1 1
Topic Options
#124120 - 2004-07-29 04:45 PM Setting Wallpaper does not work
Matt Mensching Offline
Fresh Scripter

Registered: 2003-10-03
Posts: 10
I am attempting to write a KiXtart script that sets the desktop wallpaper. I am using the SETWALLPAPER function. When I run the script I do see an error code of 0 flash up, but the wallpaper does not change. I placed the .BMP file on my machine in the root of C: (so the file is there). I am a local admin of my test machine. Here is the code:
Code:
  
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "2", "REG_SZ")
SetWallpaper ("C:\HSHWP.BMP", 1)
sleep 3



Any suggestions would be appreciated.

Thanks,

Matt

Top
#124121 - 2004-07-29 05:01 PM Re: Setting Wallpaper does not work
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
THere is nothing in your code to display error messages to the consolem, so the 0 you see is not an error code. In fact, you should be seeing 00 and they are return codes from the function as explained int he manual and in several FAQs.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124122 - 2004-07-29 05:12 PM Re: Setting Wallpaper does not work
Matt Mensching Offline
Fresh Scripter

Registered: 2003-10-03
Posts: 10
Actually you are correct, I do see 00.

Top
#124123 - 2004-07-29 08:37 PM Re: Setting Wallpaper does not work
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
This works perfectly fine for me

Code:
If SetWallpaper('C:\HSHWP.BMP', 1) = 0
'Wallpaper set okay' ?
Else
'Unable to set Wallpaper ' + @ERROR + ' ' + @SERROR
EndIf


Top
#124124 - 2004-07-29 09:56 PM Re: Setting Wallpaper does not work
Anonymous
Unregistered


Thanks for your help. It finally worked. I think it had more to do with the .BMP file. I don't think it was a true .BMP file. Once I swapped it out for a file I knew was a true .BMP file, it worked just fine.

Thanks again,

Matt

Top
#124125 - 2004-08-05 03:04 PM Re: Setting Wallpaper does not work
Alistair Offline
Fresh Scripter

Registered: 2002-08-20
Posts: 10
Loc: Aberdeen, Scotland
For the benefit of anyone who has struggled and failed with this as I have on a number of occasions, I'd like to point out that setwallpaper will only work (on NT) if you already have a wallpaper set. If you don't have a wallpaper already in place you can issue setwallpaper commands til you're blue in the face and nothing will happen!

Alistair

Top
#124126 - 2004-08-05 03:08 PM Re: Setting Wallpaper does not work
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if the user has a jpg or a gif as the wallpaper, it is an active desktop wallpaper, the BMP that you scripted will be 'hiding' under it
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#124127 - 2004-08-05 06:56 PM Re: Setting Wallpaper does not work
Glen Offline
Fresh Scripter

Registered: 2004-08-04
Posts: 6
Loc: UK
Windows 2000 or XP converts JPG to BMP if you select a JPG file under display so it can show the background. It doesnt actually show the jpg its showing a copy of the jpg as a bmp...if that helps.

Glen

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.191 seconds in which 0.131 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org