View previous topic :: View next topic |
Author |
Message |
h4c0r-BG Master Cheater Reputation: 0
Joined: 29 Nov 2006 Posts: 449 Location: The yogurt country
|
Posted: Thu May 03, 2007 10:28 am Post subject: [HELP]Delphi TForm1.Button1Click > set wall to desk |
|
|
I want to make a present for my friend. Soon he`ll have a birthday and i thought I should surprise him with a program but one of the stuff i want to make in the prog. is that when he clicks a button a wallpaper (allready loaded in the program and he does not chooses it) to be set to desktop
If you can help me and tell me what components must be used or just write that simple code that i don`t know bou i would like to
Thank you.
_________________
|
|
Back to top |
|
|
pyr0magex Grandmaster Cheater Supreme Reputation: 0
Joined: 26 Jun 2006 Posts: 1192 Location: my room
|
Posted: Thu May 03, 2007 3:49 pm Post subject: |
|
|
I found this code
Code: |
procedure SetWallpaper(
sWallpaperBMPPath : String;
bTile : boolean );
var
reg : TRegIniFile;
begin
//
// change registry
//
// HKEY_CURRENT_USER
// Control Panel\Desktop
// TileWallpaper (REG_SZ)
// Wallpaper (REG_SZ)
//
reg := TRegIniFile.Create(
'Control Panel\Desktop' );
with reg do
begin
WriteString( '', 'Wallpaper',
sWallpaperBMPPath );
if( bTile )then
begin
WriteString(
'', 'TileWallpaper', '1' );
end else
begin
WriteString(
'', 'TileWallpaper', '0' );
end;
end;
reg.Free;
//
// let everyone know that we changed
// a system parameter
//
SystemParametersInfo(
SPI_SETDESKWALLPAPER,
0,
Nil,
SPIF_SENDWININICHANGE );
end;
|
1. I don't know if it works.
2. it only works for .bmp's
3. you would have to save the image to some temporary place first and insert that as the path string
good luck
_________________
|
|
Back to top |
|
|
Renkokuken GO Moderator Reputation: 4
Joined: 22 Oct 2006 Posts: 3249
|
Posted: Thu May 03, 2007 6:49 pm Post subject: |
|
|
You could also pack the resources into the EXE.
|
|
Back to top |
|
|
|