This little example shows how to put animated (ANI) icons onto a toolbar. It creates a static control set to SS_ICON with the resource based ani's ID as it's text and places it over the button. This has the effect of a toolbar button with animation, I'm not too sure if this could be done easier but I couldn't find anything that would do it in the flags or TB_ messages so I decided to come up with a way. It was a cool idea but turned out to be far too annoying for any real applications but maybe for kid's things it might be useful. I found that most ANI icons that you find on the NET must be converted to comply with the RIFF ACON standard, Animation Shop will do it, ani's created with Toolbar Paint conform to the standard as well as those from Windows.

<Check a little further down in this thread for the file>
Posted on 2003-11-25 22:54:49 by donkey
donkey, I imagine a GUI contest program which challenges the user to use the interface - all the while rating the users effectiveness. Your example would be part of level one. :grin:
Posted on 2003-11-26 00:02:16 by bitRAKE
Hi bitRAKE,

I had originally thought it would be cool to have a print button that would spew out a sheet of paper when the program was printing and tried to figure a way to do it. In the end when I finally got it working I just found it incredibly annoying and scrapped the idea :) Figured that maybe some-one might like it so I posted it.

I love doing GUI stuff, it's about my favourite part of programming, and I usually spend more time on a GUI than on the meat and potatoes part of a program.
Posted on 2003-11-26 00:10:18 by donkey
good exercise, but i seem to have problems finding any button. eyes keep rolling to all other places.:grin:

more of a disturbance. you should try using a static pastel-shades image when the mouse pointer is not over and animate the pic when it's over it.

i hope that will look much better.

Regards,
Art:grin: :grin: :grin:
Posted on 2003-11-26 02:18:59 by art_sands
Wow, 21 downloads for something I had said was annoying :grin: Well, here's a slightly less annoying version. TBPaint can't import ANI icons directly and MicroAngelo has a pretty sucky histogram algo so the icons lost color detail when they were set from Animation Shop on an Imac to MicroAngelo on a PC but the idea is the same.

EDIT : Went direct from the IMac to Toolbar Paint, the imagelist looks much better.

EDIT: < There is a fixed version that works with Win9x further down >
Posted on 2003-11-26 10:14:41 by donkey
yeah, thats nice donkey

this might seem odd but i gotta learn a lot of gui programming from you. i'm not good at that.

I hope you've got some excellent tutorials on that up your sleeves. Roll em out a litte.

Regards,
Art
Posted on 2003-11-26 10:33:53 by art_sands
Hi Art,

Yeah, I might do some GUI tutorials. I'm kind of stuck on toolbars right now, as I'm looking for applications for the features already in TBPaint and looking for new features to add to the package. Bug fixes are just about done as there is only one bug still outstanding in my notes so I am just about ready to start expanding it again. But in the meantime I may do a couple of articles on GUI design if I can come up with something original and that is of interest.
Posted on 2003-11-26 10:42:11 by donkey
lmao I love it :alright:
Posted on 2003-12-02 23:08:41 by Homer
Hi, donkey. :)

Cool GUI effect, I wouldn't mind to see it in any program, just as long as there's a way to switch it off. ;)

Posted on 2003-12-03 10:29:30 by QvasiModo
Well, I cannot find a way to directly load an animated icon in Win9x. It just keeps returning 0 and there is no equivalent to the CreateIconFromResource function for ani's so creaating it on the fly is pretty much out as well. But I did come up with a solution however it is dirty. The ani resource is loaded from the resource section as raw data and dumped to a temporary file where it is then loaded via LoadImage. The temporary file is then deleted. Since I don't particularly like this method I will continue to look for an alternative but I don't hold out much hope as even a normal static control cannot load a resource based animated icon. The program will only use the hack if a Win9x OS is detected...

edit: just a minor clean up of the code...
Posted on 2003-12-03 13:41:55 by donkey
It's working now. :)
Strange about win98 not loading animated icons from resources. Did you try hardcoding the icons in the .data section rather than as a resource? if it works, it makes a cleaner solution...
:confused:
Posted on 2003-12-03 16:20:36 by QvasiModo
The icons are in RIFF ACON format and are very large. I guess I could put them in the data section but getting at the raw data is not a problem, that is what I do in the solution and the extra overhead is something like 40 bytes as there is already a resource section to hold the dialog and toolbar strip. The problem is to convert the data to a handle that can be used with STM_SETIMAGE, I still have found no way to do that as of yet. Also it is meant to be a general purpose demonstration, hard coding icons in .DATA is not well suited to this type of application.
Posted on 2003-12-03 16:33:49 by donkey
Well, I give up. It is perfectly possible to get a usable handle from a raw resource in Win2K using CreateIconFromResource but it doesn't work in 98SE. The experience has answered a question that I had for a while about the cursor folder in Windows. I always wondered why MS chose to place all of the ANI cursors in that folder individually as files when almost everything else in the OS was resource based. Now I know, there is no easy way to load an ANI icon or cursor (they are virtually the same thing) from resources. It was probably added to Win2K+ because it is a pretty stupid limitation.
Posted on 2003-12-04 00:49:35 by donkey