unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ClipBrd;
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_PREVIEWRATE = WM_USER + 52;
type
TForm1 =
class(TForm)
Panel1: TPanel;
Image1: TImage;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
FCapHandle :THandle;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function capCreateCaptureWindow(lpszWindowName: LPCSTR;
dwStyle: DWORD;
x, y,
nWidth,
nHeight: integer;
hwndParent: HWND;
nID: integer): HWND;
stdcall;
external '
AVICAP32.DLL'
name '
capCreateCaptureWindowA';
procedure TForm1.FormCreate;
begin
FCapHandle := capCreateCaptureWindow('
Video',ws_child+ws_visible, 0,
0, 320, 240, Panel1.handle, 1);
SendMessage(FCapHandle, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(FCapHandle, WM_CAP_SET_PREVIEWRATE, 1, 0);
SendMessage(FCapHandle, wm_cap_set_preview, 1, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage(FCapHandle, WM_CAP_EDIT_COPY, 1, 0 );
Image1.Picture.Bitmap.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0);
end;
end.