procedure TForm1.Button1Click(Sender: TObject);
var
typeDevice : String;
Hwnds : String;
Const
WS_CHILD = '1073741824';
begin
typeDevice := 'MPEGVideo';
if opendlg.Execute then
begin
myMusic := 'myMusic';
lbox.Items := opendlg.Files;
lbox.ItemIndex := 0;
pfile := lbox.Items[lbox.itemindex];
Str(OleWnd.Handle,Hwnds);
cmd := 'close ' + myMusic;
fplay := mcisendstring(pchar(cmd), '', 0, 0);
cmd := 'open ' + pfile + ' type ' + typeDevice + ' Alias ' + myMusic + ' parent ' + hwnds + ' Style ' + WS_CHILD + ' shareable';
fplay := mciSendString(pchar(cmd), '', 0, 0);
cmd := 'put ' + Mymusic + ' destination at ' + Trim(IntToStr(0)) + ' ' + Trim(IntToStr(0)) + ' ' + Trim(IntToStr(Olewnd.ClientWidth)) + ' ' + Trim(IntToStr(OleWnd.ClientHeight));
fplay := mcisendstring(pchar(cmd), nil, 0, 0);
cmd := 'play ' + myMusic;
fplay := mcisendstring(pchar(cmd), '', 0, 0);
if fplay <> 0 then
showmessage('error');
end;
end;
呵,行了。。。