//(...)
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg, clipbrd, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, StdCtrls;
type
TForm1 =
class(TForm)
Panel1: TPanel;
Timer1: TTimer;
Image1: TImage;
IdFTP1: TIdFTP;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Camhandle:Thandle;
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;
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.Button1Click(Sender: TObject);
//exit Button
begin
(* idFTP1.Disconnect;
idFTP1.Quit; Deaktiviert, da ich es momentan nicht brauche *)
Application.Terminate;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Camhandle := capCreateCaptureWindow('
Video',ws_child+ws_visible, 0,
0, 640, 480, Panel1.Handle, 1);
//wird einmalig aufgerufen
SendMessage(Camhandle, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(Camhandle, WM_CAP_SET_PREVIEWRATE, 30, 0);
Timer1.Enabled := TRUE;
// Timer einschalten, für Bilder "machen"
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
j: tjpegimage;
//Size: DWORD; wird Momentan nich gebraucht
//Result : String; wird Momentan nich gebraucht
begin
sendMessage(camhandle, WM_CAP_SET_OVERLAY, 1, 0);
//|
SendMessage(camhandle, wm_cap_set_preview, 1, 0);
//|-> Init and make clipboard = bild
SendMessage(camhandle, WM_CAP_EDIT_COPY, 1, 0 );
//\
Image1.Picture.Bitmap.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0);
//|
j := tjpegimage.create;
j.assign(Image1.Picture.Bitmap);
//save
j.SaveToFile('
cap.jpg');
(*
...
Hier steht alles zum FTP-Upload, ist aber momentan noch deaktiviert
...
*)
end;
end.