2013-04-06 34 views
1

你好,親愛的社區相對路徑的視頻文件......Inno Setup的 - 與作爲閃屏

我剛看到這個題目的視頻閃屏的Inno Setup的

Video file (with alpha) as splash-screen?

通過給出的示例代碼TLama(匯創媒體播放器的作者)是偉大的,但它有一個小問題&完蛋了:是指在代碼 飛濺的視頻文件有一個像絕對路徑:d:\ Video.avi 所以,如果我想發表我的安裝程序到其他電腦的絕對路徑如d:\ Video。 AVI就不管用了......

因此,我要求作者(TLama)修改該腳本,使視頻文件飛濺使用相對路徑,如:{SRC}或{} TMP。

那要問作者的第二次修訂是:

我想通過點擊一個窗口的客戶區來實現視頻播放結束......,是不是在上面的示例代碼中...

所以最後我要求TLama(匯創媒體播放器的作者),以實現兩個要求修訂如下代碼:

[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 '[email protected]:mediaplayer.dll stdcall'; 
function DSStopMediaPlay: Boolean; 
    external '[email protected]:mediaplayer.dll stdcall'; 
function DSInitializeVideoFile(FileName: WideString; WindowHandle: HWND; 
    var Width, Height: Integer; CallbackProc: TDirectShowEventProc): Boolean; 
    external '[email protected]: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; 

回答

2

只是交換'd:\video.avi'ExpandConstant('{tmp}\video.avi'),具有預先調用。

或者,如果你要分發的視頻旁邊的設置(例如,在DVD),而不是嵌入到它,然後用{src}代替{tmp},並跳過ExtractTemporaryFile

對第二個問題。有郵件丟失排水這將使IVideoWindow着鍵盤和鼠標消息到窗口的所有者。在庫的更新版本中,郵件將發送給所有者,因此請下載最新版本並添加如下代碼以通過點擊關閉視頻窗口:

[Code] 
procedure OnVideoFormClick(Sender: TObject); 
begin 
    // it's enough to just close the form as it owns the IVideoWindow 
    VideoForm.Close; 
end; 

procedure InitializeWizard; 
begin 
    VideoForm := CreateCustomForm; 
    ... 
    VideoForm.OnClick := @OnVideoFormClick; 
    ... 
end;