How to display an animated GIF image in a static control?

  • Thread starter Thread starter Yan Yang
  • Start date Start date
Y

Yan Yang

Guest
I can display a bitmap image without animation in a static control.

How to display a GIF image with animation in a static control? The GIF image is loaded with GDI+ in the code below, but only a static image of the first frame of the GIF is displayed, there is no animation. How to display the animation in GIF?

HBITMAP ctrlBitmap(NULL);

Gdiplus::Bitmap* pBitmap = NULL;
pBitmap = new Gdiplus::Bitmap(pStream);
pBitmap->GetHBITMAP(NULL, &ctrlBitmap);

CStatic m_ctrlImage;
m_ctrlImage.Create(NULL, WS_CHILD | SS_BITMAP | WS_VISIBLE | SS_REALSIZEIMAGE | SS_CENTERIMAGE | WS_BORDER, rectImage, this, IDC_IMAGE);
::SendMessage(m_ctrlImage, STM_SETIMAGE, IMAGE_BITMAP,(LPARAM)(HBITMAP)ctrlBitmap);
Thanks in advance.

Continue reading...
 
Back
Top