你好亲爱的社区...
我刚刚看到 Inno Setup 的视频闪屏这个主题
TLama(Inno Media Player 的作者)提供的示例代码很棒,但它有一个小问题,仅此而已:代码中指向的启动视频文件具有绝对路径,如:d:\Video.avi 所以如果我想发布我的安装程序到其他计算机的绝对路径(如 d:\Video.avi)将不再工作......
因此,我要求作者 (TLama) 修改此脚本并使视频文件飞溅到相对路径,例如:{src} 或 {tmp}。
想问作者的第二个修订是:
我想通过单击窗口的客户区来实现关闭视频播放...在上面的示例代码中不可用...
所以最后我要求 TLama(Inno Media Player 的作者)对以下代码实施两个要求的修订:
[Setup]
AppName=Media Player Project
AppVersion=1.0
DefaultDirName={pf}\Media Player Project
[Files]
Source: "MediaPlayer.dll"; Flags: dontcopy
[Code]
const
EC_COMPLETE = $01;
type
TDirectShowEventProc = procedure(EventCode, Param1, Param2: Integer);
function DSPlayMediaFile: Boolean;
external 'DSPlayMediaFile@files:mediaplayer.dll stdcall';
function DSStopMediaPlay: Boolean;
external 'DSStopMediaPlay@files:mediaplayer.dll stdcall';
function DSInitializeVideoFile(FileName: WideString; WindowHandle: HWND;
var Width, Height: Integer; CallbackProc: TDirectShowEventProc): Boolean;
external 'DSInitializeVideoFile@files:mediaplayer.dll stdcall';
var
VideoForm: TSetupForm;
procedure OnMediaPlayerEvent(EventCode, Param1, Param2: Integer);
begin
if EventCode = EC_COMPLETE then
VideoForm.Close;
end;
procedure OnVideoFormShow(Sender: TObject);
begin
DSPlayMediaFile;
end;
procedure OnVideoFormClose(Sender: TObject; var Action: TCloseAction);
begin
DSStopMediaPlay;
end;
procedure InitializeWizard;
var
Width: Integer;
Height: Integer;
begin
VideoForm := CreateCustomForm;
VideoForm.Caption := 'Popup Video Window';
VideoForm.BorderStyle := bsNone;
VideoForm.FormStyle := fsStayOnTop;
VideoForm.Position := poScreenCenter;
VideoForm.OnShow := @OnVideoFormShow;
VideoForm.OnClose := @OnVideoFormClose;
if DSInitializeVideoFile('d:\Video.avi', VideoForm.Handle, Width,
Height, @OnMediaPlayerEvent)
then
begin
VideoForm.ClientWidth := Width;
VideoForm.ClientHeight := Height;
VideoForm.ShowModal;
end;
end;
procedure DeinitializeSetup;
begin
DSStopMediaPlay;
end;