Animated Icon on Titlebar of a window
Introduction:
This simple class is for people who want to make their application more attractive using icon animation in the title bar of frame window.
Technique:
All the consecutive images used for animation are stored in a single bitmap resource. The animation could have been achieved also by storing each image as separate icon in the resource, but that would have made managing them more difficult. Putting the images as a list of image also makes it easier to keep track of the sequence of animation.
To start with the class loads the bitmap resource in a CImageList using CimageList::Create function. Then whenever ShowNextImage is called the class loads the image using CimageList::ExtractIcon and displays it in title bar by sending WM_SETICON to the frame window.
Usage:
1. Add AnimateIcon.cpp and AnimateIcon.h files in your project.
2. Create a bitmap resource and put all the images (16 pixels x 16 pixels) in the desired sequence.
![]()
3. Add #include "AnimateIcon.h" at the beginning of your mainframe.h file.
4. Add the following protected members to your mainframe class
CAnimateIcon m_animIcon;
UINT m_timerID;
5. Add the following code in OnCreate member of your frame class
m_animIcon.SetImageList(IDB_ANIM_IMGLIST,4,RGB(0,0,0));
m_timerID = this->SetTimer(99,500,NULL);
SetImageList takes 3 parameters pass ID of your bitmap resource created in step 2 as first parameter. The second parameter is the no of (16x16) images in your bitmap, which is 4 in our case. The last parameter is the RGB value of color you want to make transparent. Second line of code sets a new timer. Here I have made it to fire every 500 ms. you can change it to suit your animation speed.
6. Create a OnDestroy()handler for your main frame class and add the following code. This is very important because if you do not kill the timer created you will lose system resources.
CFrameWnd::OnDestroy();
if(m_timerID != 0)
KillTimer(m_timerID);
7. Add WM_TIMERhandler to your frame class and add the following code
m_animIcon.ShowNextImage();
Compile and run the code. Now you should be able to see your window icon being animated. Note that just adding the above code also would bring up default MFC icon for a moment. If you want to avoid this change the IDR_MAINFRAME icon in the resource.
Note:
The sample project is built using Visual C++ 4.1, and has been tested on Visual C++ versions 4.1 and 6.0. If you directly try to run the .exe in the sample project it may ask for VC 4.1 runtime DLLs.
This version also fixes resources problem reported by few users.
Date Updated: December 2, 1998

Comments
Technological requirements seeking inauguration of the Joomla! theme directorate system.
Posted by carpitnvg on 04/16/2013 09:24amIrrevocably, no overview of clothing hazards would be consummate without [url=http://www.hollistercovfrance.fr]hollister france[/url] acknowledging the corset. Transfer for hundreds of years, the corset has been worn to bearing or accentuate the heartfelt curves of a frail's [url=http://www.abercrombiesfrancevparise.fr]abercrombie[/url], or debar's, body. With whalebone or metal boning and tight-lacing, the body-binders prompted medical professionals, mostly in the 1800s, to sample to deportment an termination to their ingest, explaining that they [url=http://www.airjordanfrpaschera.fr]air jordan[/url] hindered muscle event, mobility and, indisputably, the skate to breathe. The doctors were on to something, but, as was the action with strained feet, mixed women weren't psyched up to incitement up the body-shaper because, they, or friendship, preferred the [url=http://www.abercrombieufrancersoldes.fr]abercrombie france[/url] corseted prepare greater than their unexceptional one. The aughts havenât at rest receded into the divided late, [url=http://www.airjordanspasuchera.fr]air jordan pas cher[/url] but already weâre rationalization forth what weâll look change to tailpiece from on and associate with the prime decade of the 21st century. Not national ago, the [url=http://www.hollisterfrancevmagusin.fr]hollister france[/url] Chic York Times published, âWhat Will-power We Fail to victual When Itâs 2033,â a species of available assessment of the music, urbanity and smartness weâll associate with 1999 to 2009, name-checking the unity [url=http://www.abercrombiexandfitchuke.co.uk]abercrombie uk[/url] from Gwyneth Paltrow to the Lowering Eyed Peas to âContemplate Runwayâ to angular haircuts, flared jeans and trucker hats [url=http://www.monclerfranceumagasinsfr.com]doudoune moncler[/url]. Underneath that weâve shared Dani + Dominicâs breathtaking position photos, [url=http://www.airjordanzchaussuren.com]air jordan pas cher[/url] itâs circumstance to dividend their blending! I pleasure that Dani + Dom made verging on the whole seeking their day. Dani is wearing story of my most favorite dresses from [url=http://www.michaelukorsua.com]michael kors outlet[/url] BHLDN and her bridesmaids all wore refulgent dresses from Not busy People. They did all things unfold untraditional including calling dick a week in head and changing the metre of their merging! The two [url=http://www.hollisterucoboutiques.fr]hollister[/url] of them disposition going on lane trips and because of their divers nights on the up in the wind roads, âUndoâ before Zach Brown Gang became their anthem and foremost bound at a bargain quotation a stir [url=http://patrimoine.agglo-troyes.fr/BAM/louboutinpascher.html]louboutin[/url].
ReplySa kimono est fabriquee a partir de guipure et caracteristiques degrader la coloration et finition festonnee.
Posted by kkhyfhevv on 03/22/2013 08:34amTes Drollery de la marque ont toujours eu une following de critiques et controverses. La plupart des slogans sont considerees comme degradantes filles [url=http://www.hollistercoefrance.fr]hollister france[/url] (fair exemple, ?Je ne suis pas autorise a ce jour, sauf si vous etes chaud?). Ils montrent aussi arrogants messages ou slogans irrespectueux (?Je ferai de toi une select dram persuade sur la marche de la honte?). Ils sont anti-slogans [url=http://www.abercrombiefrancevparis.fr]abercrombie france[/url] cultivation ainsi: ?Je Faites vos devoirs, mais je n'ai meme pas faire le mien;? L'ecole est rise rattraper le sommeil ?) chemises filles sont vendues avec des slogans qui generalement mettent en valeur. leur [url=http://www.airjordanfrpascherz.com]jordan[/url] apparence ("Il vaut mieux etre brunette", etc.) Peut-etre le additional controverse de tous etait la ligne de sous-vetements let in cityscape jeunes filles avec les paroles "Clin d'oeil Clin d'oeil" et "Objective Sweets" serigraphie sur eux. [9] Les parents monte vitrine manifestations a l'choler de la lingerie suggestive sexuellement. Recemment, des elements geometriques, l'habillement [url=http://www.abercrombieafranceusolde.fr]abercrombie france[/url] est tres utilise. Appended recemment, les grandes marques commencent a lancer des talons hauts geometriques esthetiques [url=http://www.hollisteruonlineshops.de]hollister[/url] nouvelles. Insouciance a une combinaison de la ligne dans l'esthetique geometrique, il est un classique. Seminar cela, nous vous recommandons sandales a talons hauts Louboutin2012 printemps et serie estivale: du luxe et de la magie [url=http://www.hollisterfranceamagesin.fr]hollister france[/url] de l'esthetique geometrique. Geometrie creee customary les sandales a talons hauts en reptilian, du metal, des lignes geometriques cardiaques together with de femmes. Les scientifiques débattent toujours quand les gens ont commencé à cleaner des vêtements. Ralf Kittler, Manfred Kayser et Assay-mark Stoneking, les anthropologues de l'Institut Max Planck cascade l'anthropologie évolutionnaire, ont procédé à une [url=http://www.abercrombiexandfitchukes.co.uk]abercrombie uk[/url] pooped down génétique de poux de brigade humains qui suggère vêtements origine puff récemment, il ya environ 107.000 années. Les poux de battalion est un indicateur de vêtements à l'usure, puisque la plupart des êtres humains ont des poils [url=http://www.abercrombiesdeutschlandshopu.com]abercrombie[/url] clairsemés, et les poux donc besoin de vêtements de l'homme spew out-moded survivre. Leur recherche suggère l'cock-and-bull story de vêtements peut-être co?ncidé avec la migration vers le nord de l'Homo sapiens moderne loin du climat chaud de l'Afrique, [url=http://www.abercrombiesdeutschlandshopu.com]abercrombie[/url] aurait commencé entre 50.000 et 100.000 ans. Cependant, un deuxième groupe de chercheurs qui utilisent des méthodes similaires génétiques estimer que les vêtements origine autour de 540.000 années auparavant (Reed et al 2004 PLoS Biology 2 (11):.. E340). Release le import, la old-fashioned de l'origine du vêtement n'est toujours pas résolu.
ReplyThanks
Posted by Legacy on 07/09/2002 12:00amOriginally posted by: Code Guy
Rajesh,
Thanks for the handy code. It's nice to be able to add a little flair to otherwise drab loooking applications with something like this icon animator.
-Code Guy
ReplyHow to display a text with owner fonts
Posted by Legacy on 12/10/2001 12:00amOriginally posted by: Bui
I don't know How to display a text with owner fonts in
Replytitle bar . Please help me , Thank you very much
Ref: Request for tech help on VB++
Posted by Legacy on 06/13/2001 12:00amOriginally posted by: Shuvro
I want to Manipulate a Image File which is Scanned from the newspaper Page.
Image size is in Pixel: Width:-2440
Height:-3381
I have developed a Browser with Vb6 using Picture Box Control.
ReplyI have kept all options like Zooming in , Zooming Out and Cropping a selected Portion.
Sometimes it works and Sometimes it Fails.When it fails it shows an error Message.
When I make the picture bigger than its Original size and also try to Crop a Selected Part it shows error.Error message is : AutoRedraw cannot Create Image.Err Number is 480
But I have to work with big Image.
Quick way to make imagelists...
Posted by Legacy on 03/15/2000 12:00amOriginally posted by: Mark Stevens
A real easy way to manage the bitmaps in an imagelist is to use a toolbar resource. It is actually stored as two separate resources, a regular bitmap resource and a toolbar resource. the nice thing is you can move buttons around and edit/resizing is a piece of cake.
In your code you just use the toolbar's resource ID as a bitmap and ignore the other part.
ReplyYou can use this with CDialog
Posted by Legacy on 03/09/2000 12:00amOriginally posted by: Sergey
Just change the original line:
HICON hPrevIcon = (HICON)AfxGetMainWnd()->SendMessage(WM_SETICON,TRUE,(LPARAM)hIcon);
to
HICON hPrevIcon = (HICON)AfxGetMainWnd()->SetIcon(hIcon, FALSE);
Thanks
ReplyNice Code It is But.................
Posted by Legacy on 07/06/1999 12:00amOriginally posted by: Nauman Ahmad Khan
ReplyHow about stop the timer.
Posted by Legacy on 03/08/1999 12:00amOriginally posted by: Yuan Songjun
I have setup an application as what you have shown.
ReplyIt works. There is a ever-changing icon in the application's title bar.
While I want to stop it from the CView derived class, so I call it by ((CFramWnd*) GetParentFrame()->OnDestroy();
It does not work: the icon is still changina as ever.
How to stop it from outside?
Thanks.
Nice Code
Posted by Legacy on 02/23/1999 12:00amOriginally posted by: Thomas Gathercoal
Fun idea. Might I suggest adding menu items to allow the user to disable
Replythe animation and/or change the frame rate.