F-IN-BOX Delphi Edition Help >> TFlashPlayerControl / TTransparentFlashPlayerControl >> Globals

LoadFlashOCXCodeFromStream

Syntax

[ Delphi ]
procedure LoadFlashOCXCodeFromStream(const AStream: TStream);

[ Builder C++ ]
void __fastcall LoadFlashOCXCodeFromStream(const Classes::TStream* AStream);

Description

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

The Application...

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

TFlashPlayerControl 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 Macromedia / Adobe Flash Player ActiveX doesn't exist on the target system. Just use LoadFlashOCXCodeFromStream method! With TFlashPlayerControl, hassling around with Macromedia / Adobe 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:

[ Delphi ]
{$RESOURCE 'res\flash.res'}
...

var
  FlashCodeStream: TResourceStream;


initialization
  FlashCodeStream := TResourceStream.Create(0, 'FlashOCXCode', 'BIN');
  FlashPlayerControl.LoadFlashOCXCodeFromStream(FlashCodeStream);
  FlashCodeStream.Free;

[ Builder C++ ]
TResourceStream* FlashCodeStream = new TResourceStream(0, "FlashOCXCode", "BIN");
Flashplayercontrol::LoadFlashOCXCodeFromStream(FlashCodeStream);
delete FlashCodeStream;

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

[ Delphi ]
var
  FlashCodeStream: TFileStream;


initialization
  FlashCodeStream := TFileStream.Create('flash.ocx', fmOpenRead or fmShareDenyNone);
  FlashPlayerControl.LoadFlashOCXCodeFromStream(FlashCodeStream);
  FlashCodeStream.Free;

[ Builder C++ ]
TFileStream* FlashCodeStream = new TFileStream("flash.ocx", fmOpenRead | fmShareDenyNone);
Flashplayercontrol::LoadFlashOCXCodeFromStream(FlashCodeStream);
delete FlashCodeStream;

More about TFlashPlayerControl
Copyright © Softanics. All rights reserved
F-IN-BOX is a registered trademark of Softanics|Delphi is a trademark of Borland Software Corporation|Macromedia and Shockwave Flash are trademarks of Adobe, Inc.