unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls,Windows, Messages,StdCtrls;
type
{ TForm1 }
TForm1 =
class(TForm)
Button1: TButton;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
const
WM_CAP_DRIVER_CONNECT = WM_USER + 10;
WM_CAP_EDIT_COPY = WM_USER + 30;
WM_CAP_SET_PREVIEW = WM_USER + 50;
WM_CAP_SET_OVERLAY = WM_USER + 51;
WM_CAP_SET_PREVIEWRATE = WM_USER + 52;
WM_CAP_DLG_VIDEOFORMAT = WM_USER+41;
WM_CAP_DLG_VIDEOSOURCE = WM_USER+42;
WM_CAP_DLG_VIDEOCOMPRESSION = WM_USER+46;
WM_CAP_STOP = (WM_User+ 68) ;
WM_CAP_DRIVER_DISCONNECT = (WM_User+ 11) ;
implementation
function capCreateCaptureWindow(lpszWindowName: LPCSTR;
dwStyle: DWORD;
x, y,
nWidth,
nHeight: integer;
hwndParent: HWND;
nID: integer): HWND;
stdcall;
external '
AVICAP32.DLL'
name '
capCreateCaptureWindowA';
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var handle22:THandle;
begin
handle22 := capCreateCaptureWindow('
Video',ws_child+ws_visible, 0,
0, 640,480, panel1.Handle, 1);
SendMessage(handle22, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(handle22, WM_CAP_SET_PREVIEWRATE, 1, 0);
//bildrate = 1
sendMessage(handle22, WM_CAP_SET_OVERLAY, 1, 0);
SendMessage(handle22, wm_cap_set_preview, 1, 0);
Application.ProcessMessages;
end;
procedure TForm1.Button1Click(Sender: TObject);
var handle22:THandle;
begin
handle22 := capCreateCaptureWindow('
Video',ws_child+ws_visible, 0,
0, 640,480, panel1.Handle, 1);
SendMessage(handle22, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(handle22, WM_CAP_SET_PREVIEWRATE, 1, 0);
sendMessage(handle22, WM_CAP_SET_OVERLAY, 1, 0);
SendMessage(handle22, wm_cap_set_preview, 1, 0);
Application.ProcessMessages;
SendMessage(handle22, WM_CAP_DRIVER_DISCONNECT, 0, 0);
end;
initialization
{$I unit1.lrs}
end.