F-IN-BOX DLL Edition Help

Features

F-IN-BOX DLL Edition is a window control to enhance Adobe / Macromedia Flash Player ActiveX features. It does not use its own engine to display movies but provide a wrapper around official swflash.ocx/flash.ocx code instead. Thus it is possible to avoid certain Macromedia Flash Player ActiveX limitations.

Load flash movies from memory directly (no temporary files!)

Using the control you can load any flash movie from memory directly. Just use the FPCM_LOADMOVIEFROMMEMORY and FPCM_PUTMOVIEFROMMEMORY messages. No temporary files! Load any movie on-the-fly from any supported source. For example, you can put one or more flash movies in the resource section of your application and then load it from the exe! That's the portability and power of F-IN-BOX!

Here's an example of how to load a flash movie from a resource:

[ C++ ]
HFPC hFPC = FPC_LoadRegisteredOCX();

if (NULL == hFPC)
    return;

HWND hwndFlashPlayerControl = 
   FPC_CreateWindow(hFPC, 
                    0, 
                    NULL, 
                    WS_CHILD | WS_VISIBLE, 
                    nLeft, 
                    nTop, 
                    nWidth, 
                    nHeight, 
                    hWnd, 
                    NULL, 
                    NULL, 
                    NULL)

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);

SFPCPutMovieFromMemory sFPCPutMovieFromMemory;

sFPCPutMovieFromMemory.lpData = lpMovieData;
sFPCPutMovieFromMemory.dwSize = dwMovieSize;

::SendMessage(hwndFlashPlayerControl, FPCM_PUTMOVIEFROMMEMORY, 0, (LPARAM)&sFPCPutMovieFromMemory);
Back to TopBack to Top

Create flash-enabled applications which are ready to work even when the Macromedia Flash Player ActiveX is not installed!

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.

F-IN-BOX 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 FPC_LoadOCXFromMemory function! With F-IN-BOX, 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 swflash.ocx/flash.ocx code from a resource:

[ C++ ]
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);

HFPC hFPC = FPC_LoadOCXFromMemory(lpFlashOCXCodeData, dwFlashOCXCodeSize);

if (NULL == hFPC)
{
    // Error
}        

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

[ C++ ]
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);

HFPC hFPC = FPC_LoadOCXFromMemory(lpFlashOCXCodeData, dwFlashOCXCodeSize);

if (NULL == hFPC)
{
    // Error
}        

UnmapViewOfFile(lpFlashOCXCodeData);
CloseHandle(hFileMapping);
CloseHandle(hFile);
Back to TopBack to Top

Transparency is fully supported

Using F-IN-BOX you are able to create applications based on transparent flash movies. You can create applications with translucency non-rectangle windows. Use Flash to make applications with modern user interface. See the code:

[ C++ ]
HFPC hFPC = FPC_LoadRegisteredOCX();

RECT rc = { 0, 0, 640, 480 };

HWND hwndFlashPlayerControl = 
   FPC_CreateWindow(hFPC, 
                    WS_EX_LAYERED, 
                    NULL, 
                    WS_POPUP | WS_VISIBLE, 
                    nLeft, 
                    nTop, 
                    nWidth, 
                    nHeight, 
                    hWnd, 
                    NULL, 
                    NULL, 
                    NULL)

ShowWindow(hwndFlashPlayerControl, SW_SHOW);

UpdateWindow(hwndFlashPlayerControl);
Back to TopBack to Top

Ability to play Flash Video (FLV) directly from memory

Using F-IN-BOX you are able to play Flash Video (FLV) from external files, URL or directly from memory. When F-IN-BOX loads Flash Video no temporary files are created everything runs directly from memory. You can encrypt your video and put into application's resource - F-IN-BOX loads FLV without ever saving or extracting the file to disk.

To play Flash Video from memory you should create flash movie that loads Flash Video from "private" URL (http://FLV/FlashVideo.flv). Flash Movie uses the following code to load Flash Video (put this in under a button in your Swf Flash Movie):

[ ActionScript ]
var netConn:NetConnection = new NetConnection();

netConn.connect(null);

var netStream:NetStream = new NetStream(netConn);

my_video.attachVideo(netStream);

netStream.setBufferTime(0);

netStream.play("http://FLV/FlashVideo.flv");

When Flash tries to load Flash Video from http://FLV/FlashVideo.flv, F-IN-BOX provides content of FLV. Use function FPC_AddOnLoadExternalResourceHandler to handle the external resources and provide them to Flash. See the code:

[ C++ ]
HFPC hFPC = FPC_LoadRegisteredOCX();

FPC_AddOnLoadExternalResourceHandler(hFPC, &GlobalOnLoadExternalResourceHandler, 0);

HRESULT WINAPI StaticGlobalOnLoadExternalResourceHandler(
    LPCTSTR lpszURL, 
    IStream** ppStream, 
    HFPC hFPC, 
    LPARAM lParam)
{
	HRESULT hr = E_FAIL;

	if (0 == lstrcmpi(lpszURL, _T("http://FLV/FlashVideo.flv")))
	{
		// Save flash video to the stream from the resource
		HMODULE hModule = GetModuleHandle(NULL);
		HRSRC hResInfo = FindResource(hModule, _T("EMBEDDED_FLV"), _T("FLV"));
		HGLOBAL hResData = LoadResource(hModule, hResInfo);
		LPCVOID lpData = LockResource(hResData);
		DWORD dwSize = SizeofResource(hModule, hResInfo);

		ULONG nWritten;
		(*ppStream)->Write(lpData, dwSize, &nWritten);

		hr = S_OK;
	}

	return hr;
}
Back to TopBack to Top

Enable/disable flash sounds

Using the library you can turn on/off all sounds in all loaded flash movies that belong to the same HFPC.

  1. Use function FPC_EnableSound to enable/disable the sounds.
  2. Use function FPC_IsSoundEnabled to get current status of sounds enabling.

[ C++ ]
void Mute()
{
   FPC_EnableSound(hFPC, FALSE);
}
Back to TopBack to Top

Get a snap image of the current flash movie frame

You can get a bitmap images from the current flash movie. It means you are able create applications that can coverts Flash movies to a series of bitmaps, JPEGs and others. Also you can build generated images to make an AVI video for example.

[ C++ ]
#include <atlimage.h>
...
SFPCGetFrameBitmap FPCGetFrameBitmap = { 0 };

::SendMessage(g_hwndFlashPlayerControl, FPCM_GET_FRAME_BITMAP, 0, (LPARAM)&FPCGetFrameBitmap);

HBITMAP hBitmap = FPCGetFrameBitmap.hBitmap;

if (NULL != hBitmap)
{
    CImage Image;

    Image.Attach(hBitmap);

    Image.Save(_T("Frame.bmp"));

    Image.Detach();

    DeleteObject(hBitmap);
}
Back to TopBack to Top

Write code which is compatible with any version of Adobe / Macromedia Flash Player ActiveX

One of the problem with Macromedia Flash Player ActiveX programming is that you have to control what version of the Macromedia Flash Player ActiveX you are using. For example, the property "Stacking" exists only in Macromedia Flash Player ActiveX 5 but doesn't exist in later revisions. F-IN-BOX automatically detects what Macromedia Flash Player ActiveX version is being used and prevents failure if access to non existant properties / methods is attempted. Applications using F-IN-BOX are not only compatible with Macromedia Flash Player ActiveX, but are also "smart" about how the Macromedia Flash Player ActiveX control is used. This makes your application more robust which can result in fewer technical support issues.

Back to TopBack to Top


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