![]() |
Flash und paintTo
Hi
Ich möchte einen Flashfilm auf einem TImage darstellen. Doch mir wird entweder ein weisses oder ein schwarzes Bild angezeigt, je nachdem, ob ich TShockwaveFlash.Create oder TShockwaveFlash.CreateParented nehme. Hier ist der Code, den ich bis jetzt habe:
Delphi-Quellcode:
unit Unit_Main;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,ShockwaveFlashObjects_TLB_186, ExtCtrls,ActiveX; type TForm1 = class(TForm) Button1: TButton; Image1: TImage; procedure Button1Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; h:THandle; FlashList: TStringList; Verbose: Boolean; FSCommands: Boolean; FlashFilename:string; FlashString:string; C: Integer; list:TStringList; implementation {$R *.dfm} procedure FSCommand(Self: TObject; Sender: TObject; const command, args: WideString); var sCommand, sArgs: String; begin if FSCommands then begin sCommand := Command; sArgs := Args; if Args <> '' then begin // end else begin // end; end; end; procedure TForm1.Button1Click(Sender: TObject); var cstc : procedure (Sender: TObject; const command, args: WideString) of object; begin CoInitialize(nil); FlashFilename:='movie.swf'; FlashString:='movie'; if not Assigned(FlashList) then begin FlashList := TStringList.Create; FlashList.Duplicates := dupError; end; //image1.Picture.Bitmap.PixelFormat:=pf32bit; image1.Left:=20; image1.Top:=20; image1.Width:=2048; image1.Height:=2048; H := FindWindow(nil,'Form1'); //C := FlashList.AddObject(FlashString, TShockWaveFlash.CreateParented(H)); C := FlashList.AddObject(FlashString, TShockWaveFlash.Create(nil)); TShockWaveFlash(FlashList.Objects[C]).ParentWindow := H; list:=TStringList.Create; list.Clear; if (H<>0) then list.add('FindWindow: erfolgreich') else list.add('FindWindow: nicht erfolgreich'); list.SaveToFile('FindWindow.txt'); list.Free; //TShockWaveFlash(FlashList.Objects[C]).BGColor:='-1'; TShockWaveFlash(FlashList.Objects[C]).Top := 10000; TShockWaveFlash(FlashList.Objects[C]).Left := 10000; TShockWaveFlash(FlashList.Objects[C]).DoubleBuffered := True; TShockWaveFlash(FlashList.Objects[C]).Visible := true; TShockWaveFlash(FlashList.Objects[C]).Movie := ExtractFilePath(ParamStr(0)) + FlashFilename; TShockWaveFlash(FlashList.Objects[C]).Width:=2048; TShockWaveFlash(FlashList.Objects[C]).Height:=2048; TShockWaveFlash(FlashList.Objects[C]).Play; TMethod(cstc).Code := @FSCommand; TMethod(cstc).Data := TShockWaveFlash(FlashList.Objects[C]); TShockWaveFlash(FlashList.Objects[C]).OnFSCommand := cstc; TShockWaveFlash(FlashList.Objects[FlashList.IndexOf(FlashString)]).PaintTo(image1.Canvas.Handle,0,0); end; end. |
AW: Flash und paintTo
Hat sich erledigt. Klappt jetzt. Ich mußte das Flash-Objekt bei top und left auf jeweils 0 und visible auf false setzen.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:02 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz