DelphiFAQ Home Search:
General :: Programming :: Delphi :: VCL
About the Delphi VCL (Visual Component Library)

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

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;