F-IN-BOX DLL Edition Help >> Extensions >> Functions

RegisterFlashWindowClassEx [deprecated]

Syntax

[ C++ ]
BOOL WINAPI RegisterFlashWindowClassEx(LPVOID lpFlashOCXCodeData, DWORD dwSizeOfFlashOCXCode);

Description

Traditionally, there are many obstacles or annoyances that one will encounter when using Macromedia Flash Player ActiveX in an application.

The Application...

  1. needs swflash.ocx/flash.ocx installed in the system before it will work.
  2. has to work flawlessly with the the already installed version of the Macromedia Flash Player ActiveX.
  3. has no easy way to prevent flash movies from being abused.

FlashPlayerControl to the rescue. It solves these problems and more!

By default, the component will use the swflash.ocx/flash.ocx that's already installed on the system. The component can alternatively use any swflash.ocx/flash.ocx that you would like to provide it with using any supported source. An example of this how you can embed the flash.ocx into the resource section of your application's exe file and then load it at runtime. Using this method, your application will work even if the Macromedia Flash Player ActiveX doesn't exist on the target system. Just use RegisterFlashWindowClassEx function! With FlashPlayerControl, hassling around with Macromedia Flash Player ActiveX installation issues are a thing the past! It's so easy to do! There are even demos provided which come complete with source code to prove it!

Here's an example of how to load the swflash.ocx/flash.ocx code from a file:

[ C++ ]
#include "f_in_box.h"

HANDLE hFile = CreateFile(_T("flash.ocx"), 
                          GENERIC_READ, 
                          FILE_SHARE_READ, 
                          NULL, 
                          OPEN_EXISTING, 
                          FILE_ATTRIBUTE_NORMAL, 
                          NULL);

DWORD dwFlashOCXCodeSize = GetFileSize(hFile, NULL);

HANDLE hFileMapping = CreateFileMapping(hFile, 
                                        NULL, 
                                        PAGE_READONLY, 
                                        0, 
                                        dwFlashOCXCodeSize, 
                                        NULL);

LPVOID lpFlashOCXCodeData = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);

if (!RegisterFlashWindowClassEx(lpFlashOCXCodeData, dwFlashOCXCodeSize))
{
    // Error
}        

UnmapViewOfFile(lpFlashOCXCodeData);
CloseHandle(hFileMapping);
CloseHandle(hFile);

Here's an example of how to load swflash.ocx/flash.ocx code from a resource:

[ C++ ]
#include "f_in_box.h"

HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, _T("FLASHOCXCODE"), _T("BIN"));
HGLOBAL hResData = LoadResource(hModule, hResInfo);
LPVOID lpFlashOCXCodeData = LockResource(hResData);
DWORD dwFlashOCXCodeSize = SizeofResource(hModule, hResInfo);

if (!RegisterFlashWindowClassEx(lpFlashOCXCodeData, dwFlashOCXCodeSize))
   return;


Copyright © Softanics. All rights reserved.
F-IN-BOX is a trademark of Softanics.
Macromedia and Shockwave Flash are trademarks of Adobe