LoadFlashOCXCodeFromStream

Syntax

Delphi

procedure LoadFlashOCXCodeFromStream(const AStream: TStream);

C++Builder

void __fastcall LoadFlashOCXCodeFromStream(const Classes::TStream* AStream);

Description

The LoadFlashOCXCodeFromStream method allows loading the Flash Player ActiveX control code (swflash.ocx or flash.ocx) directly from a stream, avoiding the need for installation or COM registration on the target system.

This is useful when you want your application to work independently of the system-installed Flash ActiveX. For example, you can embed the OCX binary inside the application resources and load it at runtime.

By default, TFlashPlayerControl uses the system-registered Flash ActiveX control. Using this method, you can provide your own version from any source such as a resource, memory stream, or file.

This approach simplifies deployment and prevents issues related to missing or unregistered Flash components.

See also: Embed Flash ActiveX.

Delphi Example (load from resource)

{$RESOURCE 'res\flash.res'}
 
var
  FlashCodeStream: TResourceStream;
 
initialization
  FlashCodeStream := TResourceStream.Create(0, 'FlashOCXCode', 'BIN');
  FlashPlayerControl.LoadFlashOCXCodeFromStream(FlashCodeStream);
  FlashCodeStream.Free;

C++Builder Example (load from resource)

TResourceStream* FlashCodeStream = new TResourceStream(0, "FlashOCXCode", "BIN");
Flashplayercontrol::LoadFlashOCXCodeFromStream(FlashCodeStream);
delete FlashCodeStream;

Delphi Example (load from file)

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

C++Builder Example (load from file)

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