65.9K
CodeProject is changing. Read more.
Home

Render SWF files and get a bitmap buffer of those rendering files

Mar 30, 2005

viewsIcon

119293

downloadIcon

4436

Render Flash files and get a bitmap buffer of those rendering files at any time.

Sample Image - Render_Flash.jpg

Introduction

This is an application that uses the ZFLASH lib, and I changed some code to render multiple Flash files at the same time.

Sample Project

Step 1: Declare a variable of the CFlashRender class:

CFlashRender m_FlashRender;

Step 2: Call a function to init Flash and set timer to get a bitmap buffer for rendering the Flash file:

m_FlashRender.InitFlash();
SetTimer(IDTIMER_FLASH, 40, NULL);

Step 3: Load a Flash file to render.

m_FlashRender2.LoadFlash(sFlashFileName);

Step 4: Edit the Timer function:

void CRenderFlashDlg::OnTimer(UINT nIDEvent) 
{
 // TODO: Add your message handler code here and/or call default
 if (nIDEvent == IDTIMER_FLASH)
 {
   m_FlashRender.DrawFrame();
   BYTE *pFlashBuffer = m_FlashRender.GetFlashBitmapBuffer();
   if (pFlashBuffer)
   {
    int size = m_FlashRender2.GetFlashBitmapSize();   
    // CShowpic m_stcFlashRender
    // CShowpic inherited from CStatic
    m_stcFlashRender.ShowImage(pFlashBuffer );
   }
  }
}