FPCLoadMovieFromMemory

Syntax

BOOL WINAPI FPCLoadMovieFromMemory(
  HWND hwndFlashPlayerControl,
  int layer,
  LPVOID lpData,
  DWORD dwSize);

Description

The FPCLoadMovieFromMemory function loads a Flash movie directly from a memory buffer into the specified layer of the Flash Player control.

This approach avoids creating temporary files and allows you to play SWF movies that are already available in memory (for example, decrypted or embedded resources).

hwndFlashPlayerControl – handle to the Flash Player control window.

layer – the target layer where the movie will be loaded.

lpData – pointer to the memory buffer containing the SWF movie data.

dwSize – size of the memory buffer, in bytes.

The function returns TRUE on success or FALSE if loading fails.

Example

// Load SWF movie from resource into memory and play it
HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, _T("EmbeddedMovie"), _T("FLASH"));
HGLOBAL hResData = LoadResource(hModule, hResInfo);
LPVOID lpMovieData = LockResource(hResData);
DWORD dwMovieSize = SizeofResource(hModule, hResInfo);
 
if (!FPCLoadMovieFromMemory(hwndFlashPlayerControl, 0, lpMovieData, dwMovieSize))
{
    MessageBox(NULL, _T("Failed to load movie from memory"), _T("Error"), MB_OK);
}