DelphiFAQ Home Search:

Have an animated icon when the form is minimized

 

comments1 comments. Current rating: 3 stars (1 votes). Leave comments and/ or 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;

Content-type: text/html

Comments:

2013-03-21, 18:33:00
anonymous from Dominican Republic  
rating
keep getting errors
[DCC Error] Unit1.pas(45): E2064 Left side cannot be assigned to
[DCC Error] Unit1.pas(47): E2064 Left side cannot be assigned to

 

 

NEW: Optional: Register   Login
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, or post under a registered account.
 

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:

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.

photo Add a picture: