// Hiermit kann man
AVI-Videos auf einem bestimmten Hintergrund
(TWinControl) uses mmsystem;
procedure schliessen;
begin
MCISendString('close all', nil, 0, 0);
end;
procedure AviPlay(datei, alias: string; Leinwand: TWinControl; x, y, wdth,
hght: integer; Full: boolean);
var f, p: string;
begin
if full then begin
f := ' fullscreen';
Leinwand := nil;
end else f := '';
if Leinwand <> nil then
p := ' parent ' + inttostr(leinwand.handle) + ' style ' +
inttostr(WS_CHILD)
else p := '';
mciSendString(pchar('open ' + datei + ' type avivideo alias ' + alias + p),
nil, 0, 0);
if Leinwand <> nil then
mciSendString(pchar('put ' + alias + ' window at ' + inttostr(x) + #32 +
inttostr(y) + #32 + inttostr(wdth) + #32 + inttostr(hght)), nil, 0, 0)
else
mciSendString(pchar('put ' +
alias + ' destination at ' + inttostr(x) + #32 +
inttostr(y) + #32 + inttostr(wdth) + #32 + inttostr(hght)), nil, 0, 0);
mciSendString(pchar('play ' + alias + f), nil, 0, 0);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
schliessen;
end;
// --- Beispielaufrufe ---
// AVI auf Form1 in Originalgröße 15 Pixel von links
// und 10 Pixel von oben abbilden
procedure TForm1.Button2Click(Sender: TObject);
begin
schliessen;
aviplay('d:\speedis.avi', 'MyAvi', Form1, 15, 10, 0, 0, false);
end;
// AVI in einem eigenen Fenster in
// Originalgröße abspielen
procedure TForm1.Button3Click(Sender: TObject);
begin
schliessen;
aviplay('d:\speedis.avi', 'MyAvi', nil, 0, 0, 0, 0, false);
end;
// AVI im Vollbildmodus abspielen
procedure TForm1.Button4Click(Sender: TObject);
begin
schliessen;
aviplay('d:\swimpool.avi', 'MyAvi', nil, 0, 0, 0, 0, true);
end;
// AVI auf ein Panel stretchen
procedure TForm1.Button5Click(Sender: TObject);
begin
schliessen;
aviplay('d:\swimpool.avi', 'MyAvi', Panel1, 0, 0, panel1.width,
panel1.height, false);
end;
// zwei AVIs gleichzeitig untereinander
// auf Form1 abspielen
procedure TForm1.Button6Click(Sender: TObject);
begin
schliessen;
aviplay('d:\speedis.avi', 'AVI_1', Form1, 5, 5, 0, 0, false);
aviplay('d:\swimpool.avi', 'AVI_2', Form1, 5, 200, 0, 0, false);
end;
|





