Mega Code Archive

 
Categories / Delphi / Ide Indy
 

How to use Logitech Webcam in Delphi

Title: How to use Logitech Webcam in Delphi Question: How to use the PictureToMemory method in the Logitech QuickCam SDK 1.0 Answer: type TMemoryStream = class(Classes.TMemoryStream); var MS : TMemoryStream; lSize : LongInt; pBuffer : ^Byte; begin MS := TMemoryStream.Create; bitmap1 := TBitmap.Create; try if VideoPortal1.PictureToMemory(0,24,0,lSize,'') = 1 then begin pBuffer := AllocMem(lSize); if VideoPortal1.PictureToMemory(0,24,integer(pBuffer),lSize,'') = 1 then begin MS.SetPointer(pBuffer,lSize); bitmap1.loadfromstream(MS); end; end; finally MS.Free; FreeMem(pBuffer); end; end;