Ads 468x60px

Smaller time frame always follow the bigger time frame. It's better wait be patience to enter in position than risk with BIG SL. Having strong trading discipline and taking losses when necessary is a sign of serious trading approach

Saturday, August 11, 2012

CHANGE WINDOWS WALLPAPER FROM YOUR PROGRAM


Many programs including major Internet browsers lets you change the Windows wallpaper. Here's how you can add similar functionality to your program: 
 
program wallpapr;

uses
  Registry, WinProcs;

procedure SetWallpaper(
            sWallpaperBMPPath : String;
            bTile : boolean );
var
  reg : TRegIniFile;
begin
  //
  // change registry
  //
  // HKEY_CURRENT_USER
  //   Control PanelDesktop
  //     TileWallpaper (REG_SZ)
  //     Wallpaper (REG_SZ)
  //
  reg := TRegIniFile.Create(
           'Control PanelDesktop' );
  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;

begin
  //
  // set wallpaper to centered winnt.bmp
  //
  SetWallpaper(
    'c:winntwinnt.bmp',
    False );
end.
Listing #1 : Delphi code. Download wallpapr (0.57 KB).

comments