Thread View: comp.lang.pascal.delphi.misc
4 messages
4 total messages
Started by Chow Hoi Ka, Eric
Mon, 24 May 1999 00:00
How to change the WallPaper ??
Author: Chow Hoi Ka, Eric
Date: Mon, 24 May 1999 00:00
Date: Mon, 24 May 1999 00:00
7 lines
1041 bytes
1041 bytes
Hello, 1) How to get the current WallPaper in the DeskTop ? 2) How to change the WallPaper ???? Best regards, Eric
Re: How to change the WallPaper ??
Author: Gerhard Grosse
Date: Sun, 23 May 1999 00:00
Date: Sun, 23 May 1999 00:00
40 lines
1691 bytes
1691 bytes
"Chow Hoi Ka, Eric" wrote:
>
> Hello,
>
> 1) How to get the current WallPaper in the DeskTop ?
> 2) How to change the WallPaper ????
>
> Best regards,
> Eric
Try this:
uses
Registry;
var
cReg: TRegistry;
sOldWallPaper: string;
begin
cReg := TRegistry.Create;
with cReg do try
RootKey := HKEY_CURRENT_USER;
OpenKey('Control Panel\desktop',False);
sOldWallPaper := ReadString('Wallpaper','');
WriteString('Wallpaper','c:\windows\mywallpaper.bmp');
CloseKey;
finally
Free;
end;
end;
You probably also have to broadcast a WM_SETTINGSCHANGE message if you
change the wallpaper, but I'm not sure about that.
Alternatively use the Win32 API function SystemParametersInfo with the
SPI_SETDESKWALLPAPER flag (for reasons beyond my understanding,
SPI_GETDESKWALLPAPER does not exist).
Hope this helps.
Gerhard
Re: How to change the WallPaper ??
Author: Dirk Claessens
Date: Sun, 23 May 1999 00:00
Date: Sun, 23 May 1999 00:00
25 lines
1462 bytes
1462 bytes
Chow Hoi Ka, Eric heeft geschreven in bericht
<374834DD.6445E556@sftw.umac.mo>...
:Hello,
:
:1) How to get the current WallPaper in the DeskTop ?
:2) How to change the WallPaper ????
:
Try :
if not SystemParametersInfo(SPI_SETDESKWALLPAPER,
0,
PChar('MyWallPaper.bmp'),
SPIF_UPDATEINIFILE) then
ShowMessage( 'Oops : ' + SysErrorMessage(GetLastError));
Also see SPI_GETDESKWALLPAPER in WIN32-Help.
Regards,
Dirk Claessens
______________________________________________
E-mail will bounce back, unless directed to:
dirk DOT claessens AT village DOT uunet DOT be
______________________________________________
Re: How to change the WallPaper ??
Author: Sonnich Jensen
Date: Mon, 24 May 1999 00:00
Date: Mon, 24 May 1999 00:00
43 lines
2125 bytes
2125 bytes
Just my 50 sents (2 comments) on this.....
Gerhard Grosse wrote in message <3748535F.E90FE04E@ph.tum.de>...
>begin
> cReg := TRegistry.Create;
> with cReg do try
> RootKey := HKEY_CURRENT_USER;
> OpenKey('Control Panel\desktop',False);
> sOldWallPaper := ReadString('Wallpaper','');
> WriteString('Wallpaper','c:\windows\mywallpaper.bmp');
> CloseKey;
> finally
> Free;
> end;
>end;
Note that win95 and 98 stores these information in the WIN.INI file under
DESKTOP. (above code for NT)
You have to check whether the unformation is in the Registry or in the INI
file.
I make a check whether it is present in the registry, and if not (KeyExists
or whatever) then I read from the INI file.
-----Original Message-----
From: Dirk Claessens <will.bounce@back.com>
>if not SystemParametersInfo(SPI_SETDESKWALLPAPER,
> 0,
> PChar('MyWallPaper.bmp'),
> SPIF_UPDATEINIFILE) then
>ShowMessage( 'Oops : ' + SysErrorMessage(GetLastError));
A problem with SystemParametersInfo in _some_ versions of Win95 (and also NT
????) is that SystemParametersInfo in this case ALWAYS returns true !!!!!
I don't know the result for 98.
Therefore is it better to read the Registry/inifile to check whether the
change was successfull !
Sonnich
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads