HTML Resource

How can I get an Animated Gif to display in a HTML resource. I'm using CHTMLView and LoadResource. The res://
works fine for bitmaps but what about gif's, and more importantly animated gif's.

Who is Participating?
ShaunWildeConnect With a Mentor Commented:
I do this all the time :)

first you have to add the resource as an HTML resource or else your webbrowser control can't find it properly - in my experience

also I always put my gifs in the .rc2 file becuase if Visual Studio tries to interpret it in the resource editor it crashes (or it does on my machine)

so into your .rc2 file add the following


I know this works for GIFs and I can't see why it wouldn't work fo animated GIFs

you can then reference it like so



#define MYGIF    100

// .RC
MYGIF    RT_RCDATA    "mygif.gif"

Tony_SebastianAuthor Commented:
#define GIF_DRUMS    160
// .RC
GIF_DRUMS    RT_RCDATA    "drums.gif"
//HTML resource code
src = "res://wizard.exe/#10/#160"

Didn't work. It still displays an empty GIF hole. I'm going to use an external html page and load it using navigate2.

Thanks for trying.
If this is still a problem, I think you can import the GIF file as a resource in your exe as a custom "GIF" resource type.  The syntax I think is similar to what you have there, but with a slight change:


There's more information at



Tony_SebastianAuthor Commented:
mweagle - Answer works !!! Although the documentation in the Internet SDK for res:// is mis-leading because it says you have to use res://<appname>/#<resource type>/#<resource ID>

where both resource type and resource ID have to be numbers and that they can not be identifiers.

Here's a blurb I copied from MSDN:

The following example shows the correct and incorrect way to format the numerical identifier for the resource type:

//winuser.h defines RT_BITMAP
#include <winuser.h>

//this is correct

//this is not correct

The following example shows the correct and incorrect way to format the numerical identifier for the resource identifier:

#define MYBITMAP 234

//this is correct

//this is not correct

I guess they're not talking about custom resources. Any way, thanks a million. Although I had a work around, I like this method better.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.