Webcam with Delphi ( II )

Below you will see new uses for using a webcam with Delphi.

STORING A SEQUENCE OF VIDEO
New components of the form:

tSaveDialog,Properties:
- Name = Guardar

tButtonProperties:
- Name = BtnAlmacenarVideo
- Caption = AlmacenarVideo

In the Onclic event of the TButton write:

PROCEDURE TForm1.BtnAlmacenarVideoClick(Sender: TObject);
BEGIN
   IF Ventana <> 0 THEN
   BEGIN
      Guardar.Filter := 'Fichero AVI (*.avi)*.avi';
      Guardar.DefaultExt := 'avi';
      Guardar.FileName := 'FicheroAvi';
      IF Guardar.Execute THEN
      BEGIN
         SendMessage(Ventana, WM_CAP_FILE_SET_CAPTURE_FILEA, 0,
            Longint(pchar(Guardar.Filename)));
         SendMessage(Ventana, WM_CAP_SEQUENCE, 0, 0);
      END;
   END;
END;



Save a picture from the capture window
Add a tButton

tButtonProperties:
- Name = BtnGuardarImagen
- Caption = Guardar Imagen

Code of the Botón

PROCEDURE TForm1.BtnGuardarImagenClick(Sender: TObject); 
BEGIN
IF Ventana <> 0 THEN
BEGIN
Guardar.FileName := 'Captura de la imagen';
Guardar.DefaultExt := 'bmp';
Guardar.Filter := 'Fichero Bitmap (*.bmp)*.bmp';
IF Guardar.Execute THEN
SendMessage(Ventana, WM_CAP_SAVEDIB, 0,
longint(pchar(Guardar.FileName)));
END;
END;




Related articles

Webcam con Delphi ( I )

Webcam con Delphi ( III )