Ver Mensaje Individual
  #2  
Antiguo 29-11-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 20
cHackAll Va por buen camino
Código Delphi [-]
function capCreateCaptureWindowA(lpWindowName: PChar; dwStyle, X, Y, nWidth, nHeight, hWnd, nID: Integer): Cardinal; stdcall external 'avicap32';
function capGetDriverDescriptionA(wDriverIndex: Word; lpszName: PChar; cbName: Cardinal; lpszVer: PChar; cbVer: Cardinal): LongBool; stdcall external 'avicap32';

function GetCapture(lpszName: PChar; hWnd: Integer): Cardinal;
var
 DeviceName: array [0..31] of Char;
 Rect: TRect;
begin
 Result := 0;
 repeat if capGetDriverDescriptionA(Result, @DeviceName, SizeOf(DeviceName), nil, 0) and (lstrcmp(@DeviceName, lpszName) = 0) then
  begin GetClientRect(hWnd, Rect);
   hWnd := capCreateCaptureWindowA('cap.wnd', WS_CHILD or WS_VISIBLE, 0, 0, Rect.Right, Rect.Bottom, hWnd, 0);
   if hWnd <> 0 then
    begin
     SendMessage(hWnd, WM_USER + 10{WM_CAP_DRIVER_CONNECT}, Result, 0);
     SendMessage(hWnd, WM_USER + 53{WM_CAP_SET_SCALE}, 1, 0);
     SendMessage(hWnd, WM_USER + 52{WM_CAP_SET_PREVIEWRATE}, 33, 0);
     SendMessage(hWnd, WM_USER + 51{WM_CAP_SET_OVERLAY}, 0, 0);
     SendMessage(hWnd, WM_USER + 50{WM_CAP_SET_PREVIEW}, 1, 0);
     ShowWindow(hWnd, SW_SHOW);
    end;
   Result := hWnd;
   Exit;
  end;
  Inc(Result);
 until Result = 10;
 Result := 0;
end;

procedure Capture(const hCapture: Cardinal; const lpFileName: PChar);
begin
 SendMessage(hCapture, WM_USER + 60{WM_CAP_GRAB_FRAME}, 0, 0);
 SendMessage(hCapture, WM_USER + 25{WM_CAP_FILE_SAVEDIB}, 0, Integer(lpFileName));
 SendMessage(hCapture, WM_USER + 50{WM_CAP_SET_PREVIEW}, 1, 0); // Restart preview
end;

var hCapture: Cardinal;

procedure TForm1.Button1Click(Sender: TObject);
begin
 Capture(hCapture, 'c:\archivo.bmp');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 hCapture := GetCapture('Creative WebCam NX Pro (VFW)', Panel1.Handle);
end;
__________________
RTFM > STFW > Foro > Truco > Post > cHackAll > KeBugCheckEx
Responder Con Cita