D
dafu2
Unregistered / Unconfirmed
GUEST, unregistred user!
TVideoPlayer = class(TWincontrol)
private
count:integer;
PlayState: TPlayState;
........................
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Play;
procedure Pause;
procedure Stop;
procedure Close;
end;
var
Graph: IGraphBuilder;
VideoWindow: IVideoWindow;
MediaControl: IMediaControl;
MediaEvent: IMediaEventEx;
RenderEngine: IRenderEngine;
GraphBuilder: IGraphBuilder;
MediaSeeking: IMediaSeeking;
constructor TVideoPlayer.Create(AOwner: TComponent);
begin
inherited ;
CoInitialize(nil);
end;
procedure TVideoPlayer.Play;
var
evCode: Integer;
videoFile: PWideChar;
VideoLongth, mPos: int64;
begin
videoFile := StringToOleStr('text750.avi');
CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, Graph);
Graph.RenderFile(VideoFile, nil);
Graph.QueryInterface(IID_IVideoWindow, VideoWindow);
VideoWindow.put_Owner(Panel.Handle);
VideoWindow.put_WindowStyle(WS_Child or WS_CLIPCHILDREN); // WS_Clipsiblings
VideoWindow.SetWindowPosition(0, 0, 300, 300);
Graph.QueryInterface(IID_IMediaEventEx, MediaEvent);
MediaEvent.SetNotifyWindow(self.Handle, WM_GraphNotify, 0); //错误has not parent windows
//第一个是确定哪个窗体将得到消息,第二个是传递什么消息.第三个无所谓.
Graph.QueryInterface(IID_IMediaControl, MediaControl);
Graph.QueryInterface(IID_IMediaSeeking, MediaSeeking);
MediaControl.Stop();
MediaControl.Run;
end;
MediaEvent.SetNotifyWindow(self.Handle, WM_GraphNotify, 0);
//错误has not parent windows
难道TWinControl在内部不可以传消息的吗?郁闷!啊
private
count:integer;
PlayState: TPlayState;
........................
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Play;
procedure Pause;
procedure Stop;
procedure Close;
end;
var
Graph: IGraphBuilder;
VideoWindow: IVideoWindow;
MediaControl: IMediaControl;
MediaEvent: IMediaEventEx;
RenderEngine: IRenderEngine;
GraphBuilder: IGraphBuilder;
MediaSeeking: IMediaSeeking;
constructor TVideoPlayer.Create(AOwner: TComponent);
begin
inherited ;
CoInitialize(nil);
end;
procedure TVideoPlayer.Play;
var
evCode: Integer;
videoFile: PWideChar;
VideoLongth, mPos: int64;
begin
videoFile := StringToOleStr('text750.avi');
CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, Graph);
Graph.RenderFile(VideoFile, nil);
Graph.QueryInterface(IID_IVideoWindow, VideoWindow);
VideoWindow.put_Owner(Panel.Handle);
VideoWindow.put_WindowStyle(WS_Child or WS_CLIPCHILDREN); // WS_Clipsiblings
VideoWindow.SetWindowPosition(0, 0, 300, 300);
Graph.QueryInterface(IID_IMediaEventEx, MediaEvent);
MediaEvent.SetNotifyWindow(self.Handle, WM_GraphNotify, 0); //错误has not parent windows
//第一个是确定哪个窗体将得到消息,第二个是传递什么消息.第三个无所谓.
Graph.QueryInterface(IID_IMediaControl, MediaControl);
Graph.QueryInterface(IID_IMediaSeeking, MediaSeeking);
MediaControl.Stop();
MediaControl.Run;
end;
MediaEvent.SetNotifyWindow(self.Handle, WM_GraphNotify, 0);
//错误has not parent windows
难道TWinControl在内部不可以传消息的吗?郁闷!啊