[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Animated Gif89a format support

Posted on 1997-12-17
10
Medium Priority
?
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 800 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 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