Change bitmap of the start button

Posted in System

Use FindWindowEx funtion for getting handle of the Start-button and after that, you may use SendMessage function with BM_SETIMAGE parameter.

var
  MyBitmap: TBitmap;
  StartBtn: THandle;
  Old: Integer;

...

procedure TForm1.Button1Click(Sender: TObject);
begin
  MyBitmap:=TBitmap.Create;
  MyBitmap.LoadFromFile('bmp1.bmp');
  StartBtn:=FindWindowEx(
    FindWindow('Shell_TrayWnd',nil),
    0,
    'Button',
    nil);
  Old:=SendMessage(
    StartBtn,
    BM_SETIMAGE,
    0,
    MyBitmap.Handle);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  SendMessage(
    StartBtn,
    BM_SETIMAGE,
    0,
    Old);
    MyBitmap.Free;
end;