Solved

Animated Gif89a format support

Posted on 1997-12-17
10
214 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:Mikey121797
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 4

Expert Comment

by:rantanen
ID: 1445680
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).
0
 
LVL 4

Expert Comment

by:rantanen
ID: 1445681
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

http://www.toptown.com/nowhere/jinhui.
0
 
LVL 4

Expert Comment

by:rantanen
ID: 1445682
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 hey...it 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)
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 4

Expert Comment

by:d003303
ID: 1445683
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
0
 

Author Comment

by:Mikey121797
ID: 1445684
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.
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1445685
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

0
 
LVL 4

Expert Comment

by:rantanen
ID: 1445686
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?
0
 
LVL 4

Expert Comment

by:rantanen
ID: 1445687
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.
0
 
LVL 8

Accepted Solution

by:
mrmick earned 200 total points
ID: 1445688
Hey Mikey,

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

http://www.winsite.com/cgi-bin/winq?query=anigif&platform=0

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.

http://member.aol.com/royalef/gifabout.htm

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

0
 

Author Comment

by:Mikey121797
ID: 1445689
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! http://member.aol.com/royalef/gifabout.htm is a wonderfull sight!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question