Win32 animated image

How can I place an animated GIF in my dialog box in my own Win32 application?

I have a download progress bar and a download process.

Thanks: -)

+6
c ++ winapi loading animated-gif
source share
5 answers

Not sure if GDI + can be considered native win32. If you can use it, check the following example: CodeProject

+6
source share

You can use the animation control . You would have to convert your .gif to .avi, though.

+5
source share

Its very easy to use GdiPlus to download various image formats, including jpeg, gif (animated), png, etc.

This code demonstrates how to quickly upload a single image frame to HBITMAP: -

#include <gdiplus.h> #pragma comment(lib,"gdiplus.lib") using namespace Gdiplus; HBITMAP LoadImageWithGdiPlus(LPCTSTR pszPngPath) { Image image(pszPngPath); int width = image.GetWidth(); int height = image.GetHeight(); BITMAPINFO bmi; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biClrImportant = 0; bmi.bmiHeader.biClrUsed = 0; bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biHeight = height; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biSize = sizeof (bmi.bmiHeader); bmi.bmiHeader.biSizeImage = 0; //calc later bmi.bmiHeader.biWidth = width; bmi.bmiHeader.biXPelsPerMeter = 0; bmi.bmiHeader.biYPelsPerMeter = 0; BYTE* pBmp = NULL; HBITMAP hbm = CreateDIBSection(NULL,&bmi,DIB_RGB_COLORS,(void**)&pBmp,NULL,0); HDC hdc = CreateCompatibleDC(NULL); HGDIOBJ hobj = SelectObject(hdc,hbm); Graphics graphics(hdc); graphics.DrawImage(&image,0,0); SelectObject(hdc,hobj); DeleteDC(hdc); return hbm; } 
+3
source share

Since you have a limited timeframe on this, I was looking for a working example for animating gifs on win32, and I found a good implementation on cplusplus.com .

He called the GIF View [direct link] Juan Suli.

0
source share

It is quite simple to implement a timer to change what is displayed. You can customize the text block, without text in it, with background color and just resize. It will look like an expanding color bar with very little overhead.

0
source share

All Articles