Old 6th February 2005, 16:28   #1
Kemenaran
Junior Member
 
Join Date: Mar 2004
Posts: 6
Pb : Change wallpaper using System plugin

Hi,

I'm trying to change windows wallpaper with the SystemParametersInfo API. I've tried :

code:
System::Call 'user32.dll::SystemParametersInfo(i 20, i 0, t "C:\wall.jpg", i 0) i'


But I only get a white-wallpaper... Output of the function is '0' (failed), and GetLastError sends me '126 : ERROR_MOD_NOT_FOUND The specified module could not be found'

Any ideas ? Thanks !
Kemenaran is offline   Reply With Quote
Old 6th February 2005, 17:18   #2
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
1. SystemParametersInfoA
2. jpeg support presents in the Active Desktop (may be also in XP?), try bmp first
3. SPIF_SENDCHANGE
4. Redraw desktop.
After this should work
Takhir is offline   Reply With Quote
Old 6th February 2005, 17:44   #3
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Quote:
1. SystemParametersInfoA
You don't need to put an "A" in front of it because System plugin detects automatically if it's needed.

Quote:
3. SPIF_SENDCHANGE
And SPIF_UPDATEINIFILE only if you want the file to appear on "Display Properties".

Quote:
4. Redraw desktop.
You don't need to redraw it manually. The function already does this job for you.

This function requires a bitmap file. (.jpg is not supported here)

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 6th February 2005, 18:55   #4
Kemenaran
Junior Member
 
Join Date: Mar 2004
Posts: 6
Just tried with a bmp file, worked perfectly.

Thanks a lot !
Kemenaran is offline   Reply With Quote
Old 7th February 2005, 06:15   #5
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Quote:
You don't need to redraw it manually. The function already does this job for you.
My beta-testers said that they have few situations when wallpaper update require manual redraw (Active desktop, Win 98, wallpaper removing, may be others, I cannot remember precisely now), so I still advise to use something like
code:

System::Call 'user32.dll::RedrawWindow(i 0, i 0, i 0, i 0x0085) i .r1'

Takhir is offline   Reply With Quote
Old 12th February 2005, 21:22   #6
Nebulus
Member
 
Join Date: Jul 2003
Posts: 70
Question

If there any way to change the wallpaper with a successful refresh using active desktop - html and/or files other than a BMP? I've been trying to make a rich desktop installer for forever and just can't get it to work.

By rich desktop, I mean an HTML file loaded with VBScript that also uses flash in the page. Any help would be greatly appreciated!
Nebulus is offline   Reply With Quote
Old 13th February 2005, 05:53   #7
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
http://forums.winamp.com/showthread....59#post1386259
I saw "create IActiveDesktop interface" in the KichiK' script, but this may serve as a base only for your task. May be easier to write a plug-in. AD works with all types supported by current IE. You can add html as "desktop component" with pActiveDesktop->AddDesktopItem() method and set wallpaper using pActiveDesktop->SetWallpaper() (2 different parts of AD). Or you can set jpeg image as a background of your AD "html component". A lot of samples in Inet.
Takhir is offline   Reply With Quote
Old 10th August 2005, 17:47   #8
Nebulus
Member
 
Join Date: Jul 2003
Posts: 70
There's a way to change wallpaper using VBScript and the Windows Scriptig Host object, but it's kinda dirty. It'll add anything to the desktop - jpg, bmp, html... Here's some code:

Dim WallPaper
Dim WP : WP = "C:\Windows\Web\Wallpaper\test.html"
Set WallPaper = CreateObject("WScript.Shell")
With WallPaper
.Regwrite "HKCU\Control Panel\Desktop\WallPaper", WP
.Run "control desk.cpl" ' run display properties
WScript.Sleep 50
.AppActivate "Desktop Properties" ' activate desktop tab
WScript.Sleep 50
If WP = "" Then
For I = 0 to 20
WScript.Sleep 50
.SendKeys "{up}" ' move the selectiong up to "none"
Next
Else
WScript.Sleep 50
.SendKeys "{up}" ' toggle the selection up
WScript.Sleep 50
.SendKeys "{down}" ' then toggle down (we've now selected the wallpaper)
End If
WScript.Sleep 50
.SendKeys "~" ' hit OK
End With
Set WallPaper = nothing
Nebulus is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump