function devwdm_SetVideoStandard(nID:longlong;VideoStandard:LONGLONG):LONGLONG;stdcall;external 'devwdm.dll';
function devwdm_InitCard(nID:longlong;handle:THandle;nWidth:integer;nHeight:integer):LONGLONG;stdcall;external 'devwdm.dll';
function devwdm_StartVideoPreview(nID:longlong):LONGLONG;stdcall;external 'devwdm.dll';
procedure TForm1.Button1Click(Sender: TObject);
begin
//使用Tpanel控件来创建捕捉窗口
hWndC:=CapCreateCaptureWindowA ('My Own Capture Window',WS_CHILD or WS_VISIBLE, //窗口样式
Panel1.Left,//X坐标
Panel1.Top,//Y坐标
panel1.Width, //窗口宽
panel1.Height, //窗口高
Form1.Handle, //窗口句柄
0); //一般为0
if hWndC <> 0 then
begin
procedure TForm1.Button2Click(Sender: TObject);
begin
if hWndC <> 0 then
begin
SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0); //将捕捉窗同驱动器断开
hWndC := 0;
end;
//close;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if hWndC <> 0 then
begin
SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0); //将捕捉窗同驱动器断开
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if hWndC <> 0 then
begin
SendMessage(hWndC,WM_CAP_FILE_SET_CAPTURE_FILEA,0,Longint(pchar('d:\test.avi')));// 录成AVI
SendMessage(hWndC, WM_CAP_SEQUENCE, 0, 0);
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if hWndC <> 0 then
begin
SendMessage(hWndC, WM_CAP_STOP, 0, 0);
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
if hWndC <> 0 then
begin
SendMessage(hWndC,WM_CAP_SAVEDIB,0,longint(pchar('D:\test.bmp')));//截图
end;
end;
procedure TForm1.Panel1Click(Sender: TObject);
begin
panel1.Height:=Panel1.Height+10;
Panel1.Width:=Panel1.Width+10;
end;