Does anyone know how I'd go about creating those screen-mate type animations, with a transparant background, so it appears that an animated character is walking across my desktop?
If you've seen the famous eSheep and various Message Mates cartoons, you know what I'm talking about.
For animation effects using Visual Basic, you have about three choices:
(1) using image controls or picture controls, and showing "frames" in sequence at intervals set by a Timer control
(2) using BitBlt and sprites/masks
(3) using Direct X
If you're not real experienced with animation, I'd recommend studying up on BitBlt, since it has a learning curve that isn't as steep as Direct X.
Also, you can use the web browser control to show animated GIF files, and can create animated GIFs using various freeware programs.
There's also a 3rd party freeware control that will display animated GIFs on a form, without having to use the browser control. I'll attach that control to this post.
I gave your zip file a try and compiled it in VB 6.0. But what I actually want is for the form's background to be transparant (not grey or any other colour), so the animation appears to be on your desktop (ie, you can see all the desktop icons, windows wallpaper, etc, behind he form). Any ideas?
To see the effect, add some controls to your form (Lables, Command Buttons, Text Boxes etc.)
Module Code
Option Explicit
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As _
Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal _
nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As _
Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Public Sub TransparentForm(frm As Form)
frm.ScaleMode = vbPixels
Const RGN_DIFF = 4
Const RGN_OR = 2
Dim outer_rgn As Long
Dim inner_rgn As Long
Dim wid As Single
Dim hgt As Single
Dim border_width As Single
Dim title_height As Single
Dim ctl_left As Single
Dim ctl_top As Single
Dim ctl_right As Single
Dim ctl_bottom As Single
Dim control_rgn As Long
Dim combined_rgn As Long
Dim ctl As Control
If frm.WindowState = vbMinimized Then Exit Sub
' Create the main form region.
wid = frm.ScaleX(frm.Width, vbTwips, vbPixels)
hgt = frm.ScaleY(frm.Height, vbTwips, vbPixels)
outer_rgn = CreateRectRgn(0, 0, wid, hgt)
That's brilliant so far, thanks. I tried it with the band animation in your previous code. The form is transparent, but the animated gif itself has a grey background when I run it via your code(I know the original gif does have transparant background). I also got rid of the border and caption bar, so we're almost there!
How do we keep the actual animation's background transparent?
I'm not sure you can make an animated gif file's background transparent. If so, it would probably be accomplished via some API call(s). And even if it is possible, it may not be possible in conjunction with the third-party DLL (gif89.dll) that I sent to you.
I suggest that you take our mutual question to www.visualbasicforum.com, where I often browse. There's a larger community of regular posters there, and many, many who are more advanced with VB than I.
I'd recommend putting up a post or series of posts demonstrating what you've accomplished so far, then post your question about how to get rid of the anigif's background color.