an API code snippet Changing the Wallpaper can yo Help?
The following shows the code completly that I want to make work,
when I put the parameter SPIF_SENDWININICHANGE as 0 the retval function
returned True,
but now it returns False, I caunt find out why,
All I want to d is set the wallpaper, instantly
can any one find the answer?
I have tryed swapping he parameters for real value, is it the String item
thats throwing me?
//=================================
unit Main;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Menus;
type
TFRM_Wallpaper = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
FRM_Wallpaper: TFRM_Wallpaper;
Const SPI_SETDESKWALLPAPER = 20;
//DLL exstensions
Function SystemParametersInfo (uAction: longint; uParam : string; lpvParam :
longint; fuWinIni :Longint): Bool; External 'user32' name
'SystemParametersInfoA'
function MessageBox(HWnd: Integer; Text, Caption: PChar; Flags: Integer):
Integer; stdcall; external 'user32.dll' name 'MessageBoxA';
implementation
{$R *.DFM}
procedure TFRM_Wallpaper.FormCreate(Sender: TObject);
Var
RetVal : bool;
Paper : String ;
begin
Paper := 'e:\_Projects\Wallpaper\alien.bmp';
retval := SystemParametersInfo( 20, 'e:\_projects\wallpaper\alien.bmp',0
,SPIF_SENDWININICHANGE);
if retval = true then
begin
end;
end;
end.