// Sie beginnen
damit, im Menü "Komponente" "ActiveX importieren" unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, ShockwaveFlashObjects_TLB, StdCtrls, ExtCtrls; type TXFlash = class(TOleControl) public procedure CreateWnd; override; end; TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; OpenDialog1: TOpenDialog; ShockwaveFlash1: TShockwaveFlash; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormResize(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.DFM} {$R flash.res} uses FileCtrl; const OCX = 'swflash.ocx'; procedure TXFlash.CreateWnd; begin inherited; // Bugfix für Größenänderung end; procedure TForm1.FormCreate(Sender: TObject); var P: PChar; SWFFLR: string; RS: TResourceStream; begin Caption := 'SWF Player'; Application.Title := Caption; Button1.caption := '&Laden'; panel1.caption := ''; panel1.height := 40; panel1.BevelOuter := bvNone; Clientwidth := 800; Clientheight := panel1.height + 600; panel1.align := alBottom; Button1.parent := panel1; Button1.top := (panel1.height - button1.height) div 2; ShockwaveFlash1.align := alClient; ShockwaveFlash1.playing := false; ShockwaveFlash1.visible := false; getmem(P, MAX_PATH); GetSystemDirectory(P, MAX_PATH); SWFFLR := string(P) + '\macromed\flash\'; freemem(P); if not FileExists(SWFFLR + OCX) then begin forcedirectories(SWFFLR); RS := TResourceStream.Create(0, 'SWFOCX', RT_RCDATA); RS.savetofile(SWFFLR + OCX); RS.Free; WinExec(PChar('regsvr32 /s ' + SWFFLR + OCX), SW_HIDE); end; end; procedure TForm1.FormResize(Sender: TObject); begin TXFlash(ShockwaveFlash1).CreateWnd; button1.left := (clientwidth - button1.width) div 2; end; procedure TForm1.Button1Click(Sender: TObject); begin if OpenDialog1.execute then begin ShockwaveFlash1.Playing := false; ShockwaveFlash1.Movie := OpenDialog1.filename; ShockwaveFlash1.backgroundcolor := clwhite; ShockwaveFlash1.loop := false; ShockwaveFlash1.menu := false; ShockwaveFlash1.visible := true; ShockwaveFlash1.play; end; end; end. |
Zugriffe seit 6.9.2001 auf Delphi-Ecke