DelphiFAQ Home Search:

Have an animated icon when the form is minimized

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

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;

Comments:

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.