Как работать с Web камерой?

=== Как работать с Web камерой? ===
First of all, get the SDK at http://developer.logitech.comhttp://developer.logitech.com
After installation, open delphi and Import ActiveX Control VPortal2 from the list. Now, create a new form, and put a VideoPortal from the ActiveX panel and a button. In the uses, add VideoPortal 
On the OnShow add: 
VideoPortal1.PrepareControl('QCSDK',
 'HKEY_LOCAL_MACHINE\Software\JCS Programmation\QCSDK', 0);
VideoPortal1.EnableUIElements(UIELEMENT_STATUSBAR, 0, 0);
VideoPortal1.ConnectCamera2;
VideoPortal1.EnablePreview := 1;
On the ButtonClick add: 
var
 BMP: TBitmap;
 JPG: TJpegImage;
 L: string;
begin
 F := 'Photos\test.jpg';
 VideoPortal1.StampBackgroundColor := clYellow;
 VideoPortal1.StampTextColor := clBlack;
 VideoPortal1.StampFontName := 'Arial';
 VideoPortal1.StampPointSize := 10;
 VideoPortal1.StampTransparentBackGround := 0;
 L := Format(' %s - %s ', [DateTimeToStr(Now), Num]);
 VideoPortal1.PictureToFile(0, 24, 'Temp.bmp', L);
 BMP := TBitmap.Create;
 JPG := TJpegImage.Create;
 BMP.LoadFromFile('Temp.bmp');
 JPG.CompressionQuality := 85;
 JPG.Assign(BMP);
 JPG.SaveToFile(F);
 BMP.Free;
 JPG.Free;
end;
It's all, run the application, you will see the image from the camera, click on the button to get a picture. 
Here is a copy a VideoPortal.Pas (constants). 
:Code
unit VideoPortal;
interface
// Copyright (c) 1996-2000 Logitech, Inc. All Rights Reserved
// User Interface Element, codes used with EnableUIElement method
const
 UIELEMENT_640x480 = 0;
 UIELEMENT_320x240 = 1;
 UIELEMENT_PCSMART = 2;
 UIELEMENT_STATUSBAR = 3;
 UIELEMENT_UI = 4;
 UIELEMENT_CAMERA = 5;
 UIELEMENT_160x120 = 6;
 // Camera status codes, returned by CameraState property
 CAMERA_OK = 0;
 CAMERA_UNPLUGGED = 1;
 CAMERA_INUSE = 2;
 CAMERA_ERROR = 3;
 CAMERA_SUSPENDED = 4;
 CAMERA_DUAL_DETACHED = 5;
 CAMERA_UNKNOWNSTATUS = 10;
 // Movie Recording Modes, used with MovieRecordMode property
 SEQUENCECAPTURE_FPS_USERSPECIFIED = 1;
 SEQUENCECAPTURE_FPS_FASTASPOSSIBLE = 2;
 STEPCAPTURE_MANUALTRIGGERED = 3;
 // Movie Creation Flags, used with MovieCreateFlags property
 MOVIECREATEFLAGS_CREATENEW = 1;
 MOVIECREATEFLAGS_APPEND = 2;
 // Notification Codes
 NOTIFICATIONMSG_MOTION = 1;
 NOTIFICATIONMSG_MOVIERECORDERROR = 2;
 NOTIFICATIONMSG_CAMERADETACHED = 3;
 NOTIFICATIONMSG_CAMERAREATTACHED = 4;
 NOTIFICATIONMSG_IMAGESIZECHANGE = 5;
 NOTIFICATIONMSG_CAMERAPRECHANGE = 6;
 NOTIFICATIONMSG_CAMERACHANGEFAILED = 7;
 NOTIFICATIONMSG_POSTCAMERACHANGED = 8;
 NOTIFICATIONMSG_CAMERBUTTONCLICKED = 9;
 NOTIFICATIONMSG_VIDEOHOOK = 10;
 NOTIFICATIONMSG_SETTINGDLGCLOSED = 11;
 NOTIFICATIONMSG_QUERYPRECAMERAMODIFICATION = 12;
 NOTIFICATIONMSG_MOVIESIZE = 13;
 // Error codes used by NOTIFICATIONMSG_MOVIERECORDERROR notification:
 WRITEFAILURE_RECORDINGSTOPPED = 0;
 WRITEFAILURE_RECORDINGSTOPPED_FILECORRUPTANDDELETED = 1;
 WRITEFAILURE_CAMERA_UNPLUGGED = 2;
 WRITEFAILURE_CAMERA_SUSPENDED = 3;
 // Camera type codes, returned by GetCameraType method
 CAMERA_UNKNOWN = 0;
 CAMERA_QUICKCAM_VC = 1;
 CAMERA_QUICKCAM_QUICKCLIP = 2;
 CAMERA_QUICKCAM_PRO = 3;
 CAMERA_QUICKCAM_HOME = 4;
 CAMERA_QUICKCAM_PRO_B = 5;
 CAMERA_QUICKCAM_TEKCOM = 6;
 CAMERA_QUICKCAM_EXPRESS = 7;
 CAMERA_QUICKCAM_FROG = 8; // MIGHT CHANGE NAME BUT ENUM STAYS THE SAME
 CAMERA_QUICKCAM_EMERALD = 9; // MIGHT CHANGE NAME BUT ENUM STAYS THE SAME
 // Camera-specific property codes used by Set/GetCameraPropertyLong
const
 PROPERTY_ORIENTATION = 0;
 PROPERTY_BRIGHTNESSMODE = 1;
 PROPERTY_BRIGHTNESS = 2;
 PROPERTY_CONTRAST = 3;
 PROPERTY_COLORMODE = 4;
 PROPERTY_REDGAIN = 5;
 PROPERTY_BLUEGAIN = 6;
 PROPERTY_SATURATION = 7;
 PROPERTY_EXPOSURE = 8;
 PROPERTY_RESET = 9;
 PROPERTY_COMPRESSION = 10;
 PROPERTY_ANTIBLOOM = 11;
 PROPERTY_LOWLIGHTFILTER = 12;
 PROPERTY_IMAGEFIELD = 13;
 PROPERTY_HUE = 14;
 PROPERTY_PORT_TYPE = 15;
 PROPERTY_PICTSMART_MODE = 16;
 PROPERTY_PICTSMART_LIGHT = 17;
 PROPERTY_PICTSMART_LENS = 18;
 PROPERTY_MOTION_DETECTION_MODE = 19;
 PROPERTY_MOTION_SENSITIVITY = 20;
 PROPERTY_WHITELEVEL = 21;
 PROPERTY_AUTO_WHITELEVEL = 22;
 PROPERTY_ANALOGGAIN = 23;
 PROPERTY_AUTO_ANALOGGAIN = 24;
 PROPERTY_LOWLIGHTBOOST = 25;
 PROPERTY_COLORBOOST = 26;
 PROPERTY_ANTIFLICKER = 27;
 PROPERTY_OPTIMIZATION_SPEED_QUALITY = 28;
 PROPERTY_STREAM_HOOK = 29;
 PROPERTY_LED = 30;
 ADJUSTMENT_MANUAL = 0;
 ADJUSTMENT_AUTOMATIC = 1;
 ORIENTATIONMODE_NORMAL = 0;
 ORIENTATIONMODE_MIRRORED = 1;
 ORIENTATIONMODE_FLIPPED = 2;
 ORIENTATIONMODE_FLIPPED_AND_MIRRORED = 3;
 COMPRESSION_Q0 = 0;
 COMPRESSION_Q1 = 1;
 COMPRESSION_Q2 = 2;
 ANTIFLICKER_OFF = 0;
 ANTIFLICKER_50Hz = 1;
 ANTIFLICKER_60Hz = 2;
 OPTIMIZE_QUALITY = 0;
 OPTIMIZE_SPEED = 1;
 LED_OFF = 0;
 LED_ON = 1;
 LED_AUTO = 2;
 LED_MAX = 3;
 PICTSMART_LIGHTCORRECTION_NONE = 0;
 PICTSMART_LIGHTCORRECTION_COOLFLORESCENT = 1;
 PICTSMART_LIGHTCORRECTION_WARMFLORESCENT = 2;
 PICTSMART_LIGHTCORRECTION_OUTSIDE = 3;
 PICTSMART_LIGHTCORRECTION_TUNGSTEN = 4;
 PICTSMART_LENSCORRECTION_NORMAL = 0;
 PICTSMART_LENSCORRECTION_WIDEANGLE = 1;
 PICTSMART_LENSCORRECTION_TELEPHOTO = 2;
 CAMERADLG_GENERAL = 0;
 CAMERADLG_ADVANCED = 1;
implementation
end.
// Example shows how to use the PictureToMemory method in the QuickCam SDK. 
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;
Source: Взято с Delphi Knowledge Base: http://www.baltsoft.com/
ID: 01621