Animated Gif89a format support

I use VB 5.0 Enterprise Edition is there a way that I can read Gif89a files and display the additonal animated frames rather than just the first. If there is a way to do this can you point me to a source or give some sample code so that I can at least find a starting point.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't have VB here right now to test this, but I used this approach with success. After having possibility to check it I'll get back, if there are problems with this.

1.  Add the WebBrowser object to your project (called Microsoft Internet Controls)
2.  Draw a WebBrowser control on your form
3.  In the Form_Load event, call WebBrowser1.Navigate:
        WebBrowser1.Navigate "c:\MyWeb\MyAnimation.gif"

Some things to consider:

 You have to have the gif as a file for the program to load; it can't be compiled into the program as eg. BMPs.

Since the picture is loaded at run time, you have to know the size of the gif when you draw the WebBrowser control.

Even withsome problems, it does give you the ability to display animated gifs (and other graphics formats).
There also is a shareware OCX called anigif.ocx. I don't know it's availability at the moment, but check author's site at
After having possibility to check my answer, I'd like to add following.

Ifyou do what I said with WebBrowser, you notice you got a 3-D look and vertical scroll bar, which you can't get rid of (at least I don't know a way). So as workaround I have done following.

Place a PictureBox on form, set it's looks to flat, no border and solid fill with your forms background color. Place the Webbrowser in this picturebox and make its Left = -30 and Top = -30 (if the scalemode of the picturebox is twips) and then adjust the picturebox's width and height properties so that you dont see WebBrowsers bottom and right borders.

I know this is tedious, but is free, if you have IE3 or better installed.

And that brings me to the final note. You can't distribute WebBrowser control, but you can always install IE on the target machine (clever marketing, MS)
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

I think the proposed answer (to put a WebBrowser Control on the Form) is much too oversized just to display a crippy GIF98a.

Remember that the WebBrowser Control uses about 4 MB of your main memory, needs to initialize the history and temporary internet files folder, etc. And the loading time of your app will reach new dimensions, that is for each instance of the 'GIF-Viewer' you instanciate (2 GIFs on form -> 5 Minutes wait ?? ;-))

Sorry, I just had to say that
Mikey121797Author Commented:
Rantanen I tried what you suggested and it just isn't the solution I was looking for. I am looking to display an animated gif with complete control over the transprancy options and etc. D003303 is right the overhead is enormous. I was looking to read the animated Gif directly if possible not depend on an installation of internet explorer. If netcape & internet explorer can display animated gifs there certainly must be a way in VB code to do the same thing and BitBlt it somewhere??! If there is a free OCX somewhere that I don't have to pay for every distributed copy.
Well, I have spewed.
Visual Basic doesn't support animated gifs; however, you can create the same affect.

Create a control array if images.  Assign the picture property of each image in the array to one of the graphics you wish to display in sequence to create the animation.  Make sure you set the top & left properties of all the images to the same value and make sure the pictures are all of the same size.   Use code to loop through the images (using a time delay in each iteration of the loop) making only one visible at time.

To create a continuously looping animation consisting of 5 images in a image control array indexed 0 to 4, put a timer control on your form and start it working in your code as follows:

   Timer1.Timer = 1000 (milliseconds  = 1 second)
   Timer1.Enabled = True

Turn it on or off with:

   Timer1.Enabled = True/False

Code in the Timer Event:

   Private Sub Timer1_Timer()
   Static i As Integer
   Const ImageCount = 5

      Image1(i).Visible = True
      Image1((i + ImageCount - 1) Mod 5).Visible = False
      i = (i + 1) Mod 5

   End Sub

I agree with comments made, except the loading time...not too bad and it is the only free possibility I know . :-)

Mikey, did you check the availability of that OCX, last time I saw info about it was $30 and $40 w/source, not too bad.

mrmick, the only problem with your solution (which is a good way to do animation) is how do you get frames from GIF to the ImageList?
One thing I forgot when talking about *free*. What is Compuserve's position these days? They have rights to that file format and at least earlier they tried to collect some royalties from everybody writing programs to manipulate GIF files.

I might be wrong, but it seems that the selection of free controls is very limited.
Hey Mikey,

I have not tried this one but you can get a free control to display animated gifs at the following site:

You can't do it using VB alone.  You will have to decode the file yourself or get a control (URL above) that will do it.  The method I provided as an answer yesterday shows how to display the gif once you've got it into an image control array (would also work with a picturebox control array).  There is a welth of info at the following site regarding Gif89a include the spec on how to read it.

Compuserve doesn't want royalties, just recognition unless their policy has changed in the last 2 years.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mikey121797Author Commented:
Thank's MrMick the Gif89a specifications are exactly what I needed to get started. AniGif still is not free but it seems to be a newer version than before. Increased Points to 200 enjoy! You deserve it! is a wonderfull sight!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.