Zitat von IcewarezDie erste M?glichkeit ?ber die Zwischenablage:
Format: Bitmap
Code
procedure SaveWebcamPicture(strFilename: string;WebcamHandle: THandle);const WM_CAP_EDIT_COPY = WM_USER + 30;var Bitmap : TBitmap;beginBitmap := TBitmap.Create;try Bitmap.PixelFormat := pf24Bit; SendMessage(WebcamHandle,WM_CAP_EDIT_COPY,1,0); Bitmap.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0); Bitmap.SaveToFile(strFilename);finally FreeAndNil(Bitmap);end;end;
Zitat von IcewarezBeispielaufruf:
Code
procedure TForm1.Button1Click(Sender: TObject);begin//VideoHandle = Zur?ckgegebenes Handle bei der InitialisierungSaveWebcamPicture('C:\test.bmp',VideoHandle);end;
Zitat von IcewarezDie zweite M?glichkeit ?ber capFileSaveDIB:
Format: JPEG
Code
function SaveWebcamPictureDIB(pFileName: PChar;WebcamHandle: THandle):Boolean;const WM_CAP_FILE_SAVEDIB = WM_USER + 25;beginif IsWindow(WebcamHandle) then result := (SendMessage(WebcamHandle,WM_CAP_FILE_SAVEDIB,0,LPARAM(pFileName)) <> 0)else result := false;end;
Zitat von IcewarezBeispielaufruf: