ShellExecute如何加入 Media player的command line |
尚未結案
|
juantonia
一般會員 發表:14 回覆:12 積分:5 註冊:2003-07-10 發送簡訊給我 |
|
ralph
初階會員 發表:41 回覆:82 積分:29 註冊:2003-02-04 發送簡訊給我 |
ShellExecute(0, nil, pchar('PLAYER'),filename,nil,SW_SHOW);
PLAYER: [The path of mplayer2.exe] /play: Start playing the file as soon the player is launched.
/close: Close the player after playback (only works when used with /play). like: ... /play /close ....
全螢幕播放=> ShellExecute(0, nil, pchar('PLAYER'),filename,nil,SW_SHOWMAXIMIZED); 自動關閉 => ShellExecute(0, nil, pchar('PLAYER'),pchar('/play /close ' filename),nil,SW_SHOW); 發表人 - ralph 於 2004/03/09 07:10:49
|
japhenchen
高階會員 發表:51 回覆:444 積分:184 註冊:2003-07-23 發送簡訊給我 |
那如果要偵測wmp是不是已經播完了,不就要用個迴圈來一直findwindow下去~~那如果同時間有其他wmp視窗也在擾亂,不就~~~~~
如果非得用WMP來完成這個專題的話,建議用
function ExecuteAndWait(const CommandLine : string) : cardinal; const ErrUINT = High(Cardinal); var tSI : TStartupInfo; tPI : TProcessInformation; dwI : DWORD; VarU : UINT; begin Result := ErrUINT; FillChar(tSI, sizeof(TStartupInfo), 0); tSI.cb := sizeof(TStartupInfo); tSI.wShowWindow:=SW_SHOW; if (CreateProcess(nil, pchar(CommandLine), nil, nil, False, CREATE_NEW_PROCESS_GROUP or NORMAL_PRIORITY_CLASS or 0, nil, nil, tSI, tPI)) then begin dwI := WaitForSingleObject(tPI.hProcess, INFINITE); if (dwI = WAIT_OBJECT_0) then if (GetExitCodeProcess(tPI.hProcess, dwI)) then Result := dwI; CloseHandle(tPI.hProcess); CloseHandle(tPI.hThread); end; end; procedure TForm.Button1click(sender:TObject); begin executeandwait('c:\program....\mplayer2.exe /play /close abc.mp3'); // 在播完上面那一首之前,不會執行底下的程式 showmessage('播放完畢'); end; |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |