Mega Code Archive
Have an animated icon when the form is minimized
This little sample program uses four TImage components to hold the icons to be used. The icons are changed from a timer.
Since you will not want to have the TImages visible on your screen, you should set their property Visible to false.
In Windows 95/ NT, the animation will appear on the tray as expected.
// This byte knows which icon is currently displayed
const
CurrentState : byte = 1;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if IsIconic(Application.Handle) then
begin
case CurrentState of
1: Application.Icon := Image1.Picture.Icon;
2: Application.Icon := Image2.Picture.Icon;
3: Application.Icon := Image3.Picture.Icon;
4: Application.Icon := Image4.Picture.Icon;
end; { case }
InvalidateRect(Application.Handle, nil, True); // critical!
if CurrentState >= 4 then
CurrentState := 1
else
inc(CurrentState);
end;
end;