How To Embed Flash Player ActiveX Using BoxedApp SDK
Embedding ActiveX controls into an application is one of the most important features of BoxedApp SDK.
The function BoxedAppSDK_RegisterCOMLibraryInVirtualRegistry registers a COM library in the virtual registry.
Internally, it loads the specified DLL (using LoadLibrary) and calls its DllRegisterServer function. All registry modifications performed by DllRegisterServer are stored in the virtual registry, leaving the system registry unchanged.
After this, CoCreateInstance and other COM initialization functions read the correct registration data from the virtual registry.
Embedding Flash Step-by-Step
1. Initialize BoxedApp SDK
BoxedAppSDK_Init();2. Create a Virtual File for Flash.ocx
LPVOID pBuffer;
DWORD dwSize;
// LoadResourceHelper gets resource pointer and size
LoadResourceHelper(
MAKEINTRESOURCE(IDR_BIN_FLASH_OCX),
_T("BIN"),
pBuffer,
dwSize);
HANDLE hVirtualFile1 =
BoxedAppSDK_CreateVirtualFile(
_T("C:\\Flash9e.ocx"),
GENERIC_READ,
FILE_SHARE_READ,
NULL,
CREATE_NEW,
0,
NULL);
DWORD dwTemp;
WriteFile(hVirtualFile1, pBuffer, dwSize, &dwTemp, NULL);
CloseHandle(hVirtualFile1);3. Register the COM Library in the Virtual Registry
BoxedAppSDK_RegisterCOMLibraryInVirtualRegistry(_T("C:\\Flash9e.ocx"));After that, when a Flash ActiveX instance is created, the COM subsystem (CoCreateInstance) retrieves its registration information from the virtual registry and instantiates the ActiveX object directly from the virtual DLL.
Notes
Using this method, you can create portable applications that rely on ActiveX or other COM components without requiring installation.
Simply create a virtual file for the required DLL and call BoxedAppSDK_RegisterCOMLibraryInVirtualRegistry.
