function capCreateCaptureWindowA(lpszWindowName: PCHAR; dwStyle: longint; x: integer;
y: integer; nWidth: integer; nHeight: integer; ParentWin: HWND;
nId: integer): HWND; STDCALL EXTERNAL 'AVICAP32.DLL';//引用DLL
hWndC := capCreateCaptureWindowA('摄像头界面', WS_CHILD or WS_VISIBLE, Pnl.Left, Pnl.Top, Pnl.Width, Pnl.Height, hnd, 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;