Windows - trocando o bitmap do botao iniciar

Top  Previous  Next

{We'll need several global variables}

var

   Form1: TForm1;

   StartButton : hWnd;

   OldBitmap   : THandle;

   NewImage : TPicture;

...

{Now, we put this code in the

OnCreate event of the form:}

 

procedure TForm1.FormCreate(Sender: TObject);

begin

 NewImage:=TPicture.create;

 NewImage.LoadFromFile('C:\Windows\Circles.BMP');

 StartButton := FindWindowEx

                 (FindWindow(

                    'Shell_TrayWnd', nil),

                     0,'Button', nil);

  OldBitmap:=SendMessage(StartButton,

                         BM_SetImage, 0,

                         NewImage.Bitmap.Handle);

 end;

...

{And this other in the OnDestroy:}

 

 procedure TForm1.FormDestroy(Sender: TObject);

 begin

  SendMessage(StartButton,BM_SetImage,0,OldBitmap);

  NewImage.Free;

 end;