Re: animated gif files problem
You will have some serious problems trying to do this without parsing the GIFs palettes and creating a black and white mask from those palettes to use for your uc's MaskPicture.
1. For your uc to work correctly, your maskpicture must be correct.
2. Each frame in a GIF can have a different mask and each frame in the GIF can be rendered at different X,Y coords and different widths/heights.
3. Because of the different disposal codes, you cannot just use the current frame's mask
4. Masks may need to be combined with previous frames' masks for your uc to draw correctly.
Simple GIFs where the disposal code is always 0,1,2 and the frames are always the same size are easy. But when you get disposal codes of 3 or a code of 2 and frame is drawn at different width,heights or different X,Y coords, then that affects the mask.
If you parse out the palette and the transparent index, you can make the palette index for the transparent index White. Then make all other colors in the palette black. This will give you a black & white (B/W) mask where the color white is transparent. That mask can be used for your uc's maskpicture and maskcolor of white.
But you still have to account for codes of 2 and 3.
With a code of 2 it means you must erase the last frame's area. With the current B/W mask, that means drawing a black rectangle equal to the x,y,width,height of the last frame. Then combining the new frame's mask to that mask.
With a code of 3 it means you must save the mask in memory, combine the current mask with the new frame's mask. When that frame is changed, restore the mask from memory and combine the new frame's mask. But code 3 also requires you to save the previous color portion of the image too and replace that when the frame changes.
As I mentioned in previous posts, the GIF parsing routine you use is not really designed for your needs. It can be modified to parse the palette and it can be modified to get the palette entry of the transparent index.
Last but not least, I cannot see how you can get TransparentBLT to work for you with transparent GIFs. How will you know what color to make transparent? The background color of the DC? What if that DCs color is in the GIF too? Each GIF frame can have a different transparency color or none at all. Also, each GIF frame can have a different palette too.
If you choose, you can use GDI+ to process GIFs and since GDI+ draws each frame with all the disposal codes already processed, it would be very easy to create a B/W mask for each frame. But GDI+ does require some learning if you are not familiar with it and GDI+ is installed on XP and above automatically, but on lesser operating systems, it must be downloaded from Microsoft and installed if not already installed.
Edited: Since VB allows you to have a multicolor mask, GDI+ would allow you then to simply render the frame (with transparency) to a bitmap and use that bitmap as the mask. However, you'd still have an issue because you need to know what bitmap background color to use that isn't in any of the GIF frames. This sounds easy but can be difficult because though GIF palettes are limited 256 colors, each frame can have its own palette and therefore a current image combining more than one frame can theoretically contain 16million colors. A few years ago, I did find a site where someone actually created a GIF that contained millions of colors, using mulitple frames and multiple palettes.