F-IN-BOX DLL Edition Help

Usage

F-IN-BOX, DLL Edition is a window control to enhance Macromedia / Adobe 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 / Adobe Flash Player ActiveX limitations.

Creating an f-in-box window

First of all, create a HFPC handle. If you want to use a flash ocx registered in the system, call FPC_LoadRegisteredOCX. If you want to load flash ocx from the memory, use FPC_LoadOCXCodeFromMemory. FPC_LoadRegisteredOCX / FPC_LoadOCXCodeFromMemory loads flash ocx code and registers a f-in-box window class. To obtain an atom of this class, use FPC_GetClassAtom. Pass this atom to CreateWindow / CreateWindowEx to create an f-in-box window. Also you can use FPC_CreateWindow.

After destroying all f-in-box windows which are belong to a HFPC, call FPC_UnloadCode to unload flash ocx code.

There are few types of f-in-box windows:

  • Child window, flash player uses Window Mode
  • Child window, flash player uses Transparent Mode

    Using this type, you can capture frames with alpha channel. See more TODO:

  • Popup window, flash player uses Transparent Mode

    You can create semitransparent windows based on flash movies. Useful option for modern GUI.

    Using this type, you can capture frames with alpha channel.

Examples:

[ C++ ]
HFPC hFPC;
HWND hwndFPC1, hwndFPC2, hwndFPC3;

...

HFPC hFPC = FPC_LoadRegisteredOCX();

if (NULL == hFPC)
   // Error
   return;

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

hwndFPC2 = 
   CreateWindow((LPCTSTR)FPC_GetClassAtom(theApp.m_hFPC), 
                NULL, 
                WS_CHILD | WS_VISIBLE | FPCS_TRANSPARENT, 
                rc.left, 
                rc.top, 
                rc.right - rc.left, 
                rc.bottom - rc.top, 
                hWnd, 
                NULL, 
                NULL, 
                NULL);

hwndFPC3 = 
   CreateWindowEx(WS_EX_LAYERED, 
                  (LPCTSTR)FPC_GetClassAtom(m_hFPC), 
                  NULL, 
                  WS_POPUP | WS_VISIBLE, 
                  rc.left, 
                  rc.top, 
                  rc.right - rc.left, 
                  rc.bottom - rc.top, 
                  NULL, 
                  NULL, 
                  NULL, 
                  NULL);

...

if (NULL != hFPC)
{
   FPC_UnloadCode(hFPC);
   hFPC = NULL;
}
Back to TopBack to Top

Loading a movie

You can load a movie from local file or URL, use FPC_LoadMovie or FPC_PutMovie. This functions call native flash interface.

You can load a movie from any source. There are few options:

  • You have a memory block that contains a movie. Call FPCLoadMovieFromMemory / FPCPutMovieFromMemory. Use this functions if the movie is not very big.
  • You have a resource that contains a movie. Call FPCLoadMovieFromResource / FPCPutMovieFromResource. Use this functions if the movie is not very big.
  • Your movie is very big or a loading could take much time (for example, you are getting a movie from remote source with limited speed). In this case, call FPCLoadMovieUsingStream / FPCPutMovieUsingStream. This functions return a stream assigned with a movie content. You should write movie content to this stream and Release it where all data is provided.

Examples:

[ C++ ]
// Load movie from resource
FPCPutMovieFromResource(hwndFlashPlayerControl, NULL, _T("MOVIE"), _T("SWF"));

...

IStream* pStream;
FPCPutMovieUsingStream(hwndFlashPlayerControl, &pStream);

while (...)
   if (S_OK != pStream->Write(...))
      break;

pStream->Release();

...

IStream* pStream;
FPCPutMovieUsingStream(hwndFlashPlayerControl, &pStream);

IStream* pStreamForMarshalling;
CoMarshalInterThreadInterfaceInStream(IID_IStream, pStream, &pStreamForMarshalling);

pStream->Release();
pStream = NULL;

DWORD dwThreadId;
HANDLE hThread = 
   CreateThread(NULL, 
                0, 
                &FlashContentProviderThread, 
                (LPVOID)pStreamForMarshalling, 
                0, 
                &dwThreadId);
CloseHandle(hThread);

DWORD WINAPI FlashContentProviderThread(LPVOID lpParameter)
{
   CoInitialize(NULL);

   IStream* pStreamForMarshalling = (IStream*)lpParameter;

   IStream* pStream;
   CoUnmarshalInterface(pStreamForMarshalling, IID_IStream, (void**)&pStream);

   while (...)
      if (S_OK != pStream->Write(...))
         break;

   pStreamForMarshalling->Release();
   pStream->Release();

   CoUninitialize();
}
Back to TopBack to Top

External resources loading (*.mp3, *.xml, Flash Video - *.flv, etc.)

A movie can try to load external resources. You can intercept this event and provide content of a resource.

A movie loads external resource by full path (i.e. beginning with http://). To provide data of the resource, you should set a handler (using FPC_AddOnLoadExternalResourceHandler). The handler is calling when such resource is loading.

A movie was loaded from a stream, a memory block or a resource. The movie loads an external resource (*.swf, *.jpg, *.mp3, but except *.flv - flash video) by relative path (i.e. something like "images/image1.jpg"). To provide data of the resource, you should handle the notification FPCN_LOADEXTERNALRESOURCE or FPCN_LOADEXTERNALRESOURCEEX.

Back to TopBack to Top

Turning on / off the sound. Setting the sound volume

To enable / disable flash sounds call FPC_EnableAudio. To set volume call FPC_SetSoundVolume.

Back to TopBack to Top

Capturing (with / without alpha channel).

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