Delphi 控制摄像头[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 koy0755 的 blog

开始按钮代码如下:

begin
hwndc := capcreatecapturewindowa(‘my own capture window‘,ws_child or ws_visible ,panel1.left,panel1.top,panel1.width,panel1.height,form1.handle,0);

hwndc := capcreatecapturewindowa(‘my own capture window‘,ws_child or ws_visible ,panel1.left,panel1.top,panel1.width,panel1.height,form1.handle,0);
if hwndc <> 0 then
begin
sendmessage(hwndc, wm_cap_set_callback_videostream, 0, 0);
sendmessage(hwndc, wm_cap_set_callback_error, 0, 0);
sendmessage(hwndc, wm_cap_set_callback_statusa, 0, 0);
sendmessage(hwndc, wm_cap_driver_connect, 0, 0);
sendmessage(hwndc, wm_cap_set_scale, 1, 0);
sendmessage(hwndc, wm_cap_set_previewrate, 66, 0);
sendmessage(hwndc, wm_cap_set_overlay, 1, 0);
sendmessage(hwndc, wm_cap_set_preview, 1, 0);
end;
f9运行一下,怎么样,是不是可以看到摄像头的视屏了?

那怎么停下来?再加个按钮caption设置成"停止"
代码如下:
if hwndc <> 0 then begin
sendmessage(hwndc, wm_cap_driver_disconnect, 0, 0);
hwndc := 0;
end;

视屏截到了,怎么把它给保存下来呢?

下面按两种方式保存,一个是bmp静态图,一个是avi动画。

再放三个按钮到窗体上去,caption分别设置成"保存bmp""开始录像""停止录像"

本文关键:Delphi 控制摄像头
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top