Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 03-01-2008
angelp4492 angelp4492 is offline
Miembro
 
Registrado: dic 2007
Posts: 99
Poder: 0
angelp4492 cantidad desconocida en este momento
socket y webcam

Hola como estan?

estuve probando este codigo y va muy bien, pero mi duda es como podria mandar la imagen via socket.



Código Delphi [-]
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;
type
  TForm1 = class(TForm)
    Panel1: TPanel;
    OpenVideo: TButton;
    CloseVideo: TButton;
    GrabFrame: TButton;
    SaveBmp: TButton;
    StartAvi: TButton;
    StopAvi: TButton;
    SaveDialog1: TSaveDialog;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure CloseVideoClick(Sender: TObject);
    procedure GrabFrameClick(Sender: TObject);
    procedure SaveBmpClick(Sender: TObject);
    procedure StartAviClick(Sender: TObject);
    procedure StopAviClick(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
     hWndC : THandle;
      CapturingAVI : bool;
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
 const WM_CAP_START = WM_USER;
const WM_CAP_STOP = WM_CAP_START + 68;
const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
const WM_CAP_SAVEDIB = WM_CAP_START + 25;
const WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
const WM_CAP_SEQUENCE = WM_CAP_START + 62;
const WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
 
function capCreateCaptureWindowA(lpszWindowName : PCHAR;
  dwStyle : longint;
  x : integer;
  y : integer;
  nWidth : integer;
  nHeight : integer;
  ParentWin : HWND;
  nId : integer): HWND;
  STDCALL EXTERNAL 'AVICAP32.DLL';
 

procedure TForm1.FormCreate(Sender: TObject);
begin
  CapturingAVI := false;
  hWndC := 0;
  SaveDialog1.Options :=
  [ofHideReadOnly, ofNoChangeDir, ofPathMustExist]

end;
procedure TForm1.CloseVideoClick(Sender: TObject);
begin
 if hWndC <> 0 then begin
  SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0);
  hWndC := 0;
  end;

end;
procedure TForm1.GrabFrameClick(Sender: TObject);
begin
if hWndC <> 0 then
  SendMessage(hWndC, WM_CAP_GRAB_FRAME, 0, 0);

end;
procedure TForm1.SaveBmpClick(Sender: TObject);
begin
if hWndC <> 0 then begin
  SaveDialog1.DefaultExt := 'bmp';
  SaveDialog1.Filter := 'Bitmap files (*.bmp)|*.bmp';
  if SaveDialog1.Execute then
  SendMessage(hWndC,
  WM_CAP_SAVEDIB,
  0,
  longint(pchar(SaveDialog1.FileName)));
  end;

end;
procedure TForm1.StartAviClick(Sender: TObject);
begin
 if hWndC <> 0 then begin
  SaveDialog1.DefaultExt := 'avi';
  SaveDialog1.Filter := 'AVI files (*.avi)|*.avi';
  if SaveDialog1.Execute then begin
  CapturingAVI := true;
  SendMessage(hWndC,
  WM_CAP_FILE_SET_CAPTURE_FILEA,
  0,
  Longint(pchar(SaveDialog1.FileName)));
  SendMessage(hWndC, WM_CAP_SEQUENCE, 0, 0);
  end;
  end;

end;
procedure TForm1.StopAviClick(Sender: TObject);
begin
SendMessage(hWndC, WM_CAP_STOP, 0, 0);
  CapturingAVI := false;
  end;
 

procedure TForm1.Timer1Timer(Sender: TObject);
begin
hWndC := capCreateCaptureWindowA('My Own Capture Window',
  WS_CHILD or WS_VISIBLE ,
  Panel1.Left,
  Panel1.Top,
  Panel1.Width,
  Panel1.Height,
  Form1.Handle,
  0);
  if hWndC <> 0 then
  SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
end;
end.

Última edición por angelp4492 fecha: 03-01-2008 a las 01:45:12.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
WebCam samame API de Windows 60 25-02-2008 10:44:23
Funcionamiento Webcam ANDRES86 Varios 0 04-04-2007 22:11:35
webcam, escaner y fax alt126 .NET 0 28-05-2006 16:59:40
NMFTP :Error 10038 Socket operation on non socket judit Internet 2 25-05-2006 09:06:33
WebCam con Delphi tannyk Varios 0 01-02-2005 01:32:30


La franja horaria es GMT +2. Ahora son las 19:39:05.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi