procedure TForm1.Button4Click(Sender: TObject);
var handle:THandle;
begin
handle := capCreateCaptureWindow('
Video',ws_child+ws_visible, 0,
0, 320, 240, Panel1.Handle, 1);
SendMessage(
handle, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(
handle, WM_CAP_SET_PREVIEWRATE, 30, 0);
sendMessage(
handle, WM_CAP_SET_OVERLAY, 1, 0);
SendMessage(
handle, wm_cap_set_preview, 1, 0);
//save the image in Clipboard
SendMessage(
handle, WM_CAP_EDIT_COPY, 1, 0 );
Image1.Picture.Bitmap.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0);
end;