Display Animated Gif Within Your Program

This tip will explain you how to use the WebBrowser ActiveX control to display animated gif file within your program.

Preparations

Add the WebBrowser ActiveX control to your form. go to 'Tools' (in VB 4.0) then choose 'Custom Controls', then mark the 'Microsoft Internet Controls' check box, and press OK.
Note - you must have Internet Explorer 3.0 or greater installed in your computer to have this ActiveX control.

Form Code

Private Sub Form_Load()
'Replace 'C:\myDir\myFile.gif' with your GIF file.
'the following two lines should be written in one line

WebBrowser1.Navigate "about:<html><body scroll='no'><img src='C:\myDir\myFile.gif'></img></body></html>"
End Sub

Go Back