抓图(50分)

  • 主题发起人 主题发起人 D影子D
  • 开始时间 开始时间
D

D影子D

Unregistered / Unconfirmed
GUEST, unregistred user!
我可以抓avi全屏时的图,但抓不了wmv的图,为什么?
怎么办?有具体例子吗?
 
用DirectX方式抓即可,可以使用Hsnapdx进行抓图
 
具体的视频捕捉程序:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, MPlayer, Menus;

type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
file1: TMenuItem;
open1: TMenuItem;
exit1: TMenuItem;
OpenDialog1: TOpenDialog;
MediaPlayer1: TMediaPlayer;
PaintBox1: TPaintBox;
Button1: TButton;
procedure open1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure PaintBox1Click(Sender: TObject);
private
imgbitmap: Tbitmap;
{ Private declarations }
public
{ Public declarations }
end;


var
Form1: TForm1;
implementation

{$R *.dfm}

procedure TForm1.open1Click(Sender: TObject);
begin

if opendialog1.Execute then

begin

mediaplayer1.FileName:=opendialog1.FileName;
mediaplayer1.Open;
mediaplayer1.Display:=form1;
mediaplayer1.DisplayRect:=rect(200,0,400,200);
end;

end;


procedure TForm1.Button1Click(Sender: TObject);
begin

imgbitmap.Canvas.CopyRect(rect(0,0,200,200),form1.canvas,rect(200,0,400,200));
paintbox1.Invalidate;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin

imgbitmap:=tbitmap.Create;
imgbitmap.Height:=200;
imgbitmap.Width:=200;
imgbitmap.Canvas.Rectangle(0,0,200,200);
imgbitmap.SaveToFile('img.bmp');
end;


procedure TForm1.FormPaint(Sender: TObject);
begin

canvas.FrameRect(rect(0,0,200,200));
end;


procedure TForm1.PaintBox1Click(Sender: TObject);
begin

paintbox1.Canvas.CopyRect(rect(0,0,200,200),imgbitmap.Canvas,rect(0,0,200,200));
end;


end.
 
用Directx方式抓
 
接受答案了.
 
后退
顶部