我已经仔细研究了源代码,发现这两段程序。
procedure TMediaPlayer.SetDisplay( Value: TWinControl );
var
AWindowParm: TMCI_Anim_Window_Parms;
begin
if (Value <> nil) and MCIOpened and FHasVideo then
begin
FFlags := mci_Wait or mci_Anim_Window_hWnd;
AWindowParm.Wnd := Longint(Value.Handle);
FError := mciSendCommand( FDeviceID, mci_Window, FFlags, Longint(@AWindowParm) );
if FError <> 0 then
FDisplay := nil {alternate window not supported}
else
begin
FDisplay := Value; {alternate window supported}
Value.FreeNotification(Self);
end;
end
else FDisplay := Value;
end;
procedure TMediaPlayer.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if (Operation = opRemove) and (AComponent = FDisplay) then
begin
if MCIOpened then SetOrigDisplay;
FDisplay := nil;
end;
end;
{ special case to set video display back to original window,
when FDisplay's TWinControl is deleted at runtime }
procedure TMediaPlayer.SetOrigDisplay;
var
AWindowParm: TMCI_Anim_Window_Parms;
begin
if MCIOpened and FHasVideo then
begin
FFlags := mci_Wait or mci_Anim_Window_hWnd;
AWindowParm.Wnd := mci_Anim_Window_Default;
FError := mciSendCommand( FDeviceID, mci_Window, FFlags, Longint(@AWindowParm) );
end;
end;
里面说只有当你运行的时候删除FDisplay's TWinControl
他才会SetOrigDisplay也就是另开一个窗口。
我想vcl没什么问题,你能否把你的程序发给我一份看看??
puzzledj@163.com