Einzelnen Beitrag anzeigen

taktaky
(Gast)

n/a Beiträge
 
#1

WebCam Code / Bild von WebCam holen

  Alt 12. Sep 2007, 23:10
Hallo,

ich wollte ein Bild von meiner WebCam über ein Button in Form1 kopieren.

Ich bekomme eine FehlerMeldung beim Klicken auf Button : Unsepported Clipboard Format

Hier ist der Code
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Clipbrd;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button1Click(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;

implementation

{$R *.dfm}

//Dann brauchst du noch das hier
function capCreateCaptureWindow(lpszWindowName: LPCSTR;
  dwStyle: DWORD;
  x, y,
  nWidth,
  nHeight: integer;
  hwndParent: HWND;
  nID: integer): HWND; stdcall;
  external 'AVICAP32.DLLname 'capCreateCaptureWindowA';

procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage( handle, WM_CAP_EDIT_COPY, 1, 0 );
Image1.Picture.Bitmap.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0);
end;

end.
Angehängte Dateien
Dateityp: rar webcam_210.rar (5,4 KB, 30x aufgerufen)
  Mit Zitat antworten Zitat