unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, clipbrd;
type
TForm3 =
class(TForm)
Panel1: TPanel;
Button1: TButton;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form3: TForm3;
VHandle : THandle;
const
WM_CAP_DRIVER_CONNECT = WM_USER + 10;
WM_CAP_DRIVER_DISCONNECT = WM_USER + 11;
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;
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 TForm3.Button1Click(Sender: TObject);
begin
//Bild in Zwischenablage kopieren
SendMessage(Vhandle, WM_CAP_EDIT_COPY, 1, 0 );
Image1.Picture.Bitmap.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0);
end;
procedure TForm3.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
SendMessage(Vhandle, WM_CAP_DRIVER_DISCONNECT, 0, 0);
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
Vhandle := capCreateCaptureWindow('
Video',ws_child+ws_visible, 0,
0, 320, 240, Panel1.Handle, 1);
SendMessage(Vhandle, WM_CAP_DRIVER_CONNECT, 0, 0);
//<----------Fehler
SendMessage(Vhandle, WM_CAP_SET_PREVIEWRATE, 30, 0);
//<----------Fehler
sendMessage(Vhandle, WM_CAP_SET_OVERLAY, 1, 0);
SendMessage(Vhandle, wm_cap_set_preview, 1, 0);
Image1.Picture.Bitmap.PixelFormat := pf24Bit;
end;