Thanks Bingen...
I Solved with this code below and add VFW32.a from MINGW.
/* Esta função captura imagem tanto de webcam como de scanner.
O driver do dispositivo de captura necessita estar devidamente instalado
no computador.
A dll eztw32 necessita estar no diretório da aplicação ou na pasta
system32 do windows.
*/
::dCapture := TCapture():New( ::oBevel1 )
IF ::dCapture:Conect()
::dCapture:PreviewRate( 15 )
::dCapture:PreViewScale( .T. )
::dCapture:Preview(.T.)
ELSE
MsgInfo("Cí¢mera desconectada !")
ENDIF
#include "Xailer.ch"
//---------------------------------------------------------- --------------------
/**
Clase de captura de imágenes através de WebCam
Original de Rafa Carmona THE FULL
con la colaboración de José Lalín
Modificaciones de Pablo Herranz y Bingen Ugaldebere
**/
//---------------------------------------------------------- --------------------
CLASS TCapture FROM TControl
DATA oWnd, hWndC
DATA nIndex INIT 0 // By Default index first found METHOD
New() CONSTRUCTOR
METHOD New() CONSTRUCTOR
METHOD Conect() INLINE ConectDriver( ::hWndC,
::nIndex )
METHOD End() INLINE DisConectDriver( ::hWndC )
*METHOD StartCapture() INLINE Capture( ::hWndC )
*METHOD StopCapture() INLINE CaptureStop( ::hWndC )
METHOD Preview( lPreview ) INLINE CapPreview( ::hWndC, lPreview )
METHOD PreviewRate( nRate ) INLINE CapPreviewRate( ::hWndC, nRate )
METHOD PreViewScale( lScale ) INLINE CapPreviewScale(
::hWndC,lScale )
METHOD CreateWndCapture()
*METHOD FileSaveAs( cFileName ) INLINE CapFileSaveAs( ::hWndC,
cFilename )
METHOD SaveFoto( cFile ) INLINE capFileSaveDIB(::hWndC, cFile)
*METHOD SetFile( cFile ) INLINE CapFileSetCaptureFile( ::hWndC,
cFile )
*METHOD SetupCapture() INLINE CapCaptureSetSetup( ::hWndC )
METHOD SetupVideo() INLINE SetupVideo( ::hWndC )
*METHOD Overlay( lMode ) INLINE CapOverlay( ::hWndC, lMode )
*METHOD FramesPerSec( nFrames ) INLINE CapFramesPerSec( ::hWndC,
nFrames )
*METHOD VideoCompression() INLINE CapDlgVideoCompression(
::hWndC )
*METHOD ListDrivers()
*METHOD EnumDrivers()
END CLASS
//---------------------------------------------------------- --------------------
METHOD New( oCtrl ) CLASS TCapture
::oWnd := oCtrl
*IF ::EnumDrivers() > 0
IF Len( CapGetDrivers() ) > 0
::CreateWndCapture()
ELSE
Application:lBusy:=.F.
// CMmsg(300,230, "O", "*", 1, "",.T.,{"Não encontrado o driver da
cí¢mera !","R"})
MsgAlert("Não encontrado o driver da cí¢mera !","R")
ENDIF
RETURN Self
//---------------------------------------------------------- --------------------
*METHOD EnumDrivers() CLASS TCapture
*Return( Len( CapGetDrivers() ) )
//---------------------------------------------------------- --------------------
*METHOD ListDrivers() CLASS TCapture
*Return CapGetDrivers()
//---------------------------------------------------------- --------------------
METHOD CreateWndCapture() CLASS TCapture
::hWndC := CaptureWin( "", nOR( WS_CHILD, WS_VISIBLE ),;
::oWnd:nClientLeft, ::oWnd:nClientTop,;
::oWnd:nClientWidth, ::oWnd:nClientHeight,;
::oWnd:handle, 0 )
RETURN NIL
//---------------------------------------------------------- --------------------
#pragma BEGINDUMP
#include "Windows.h"
#include "Xailer.h"
#include "vfw.h"
#include "hbapi.h"
HB_FUNC( CAPTUREWIN )
{
HWND hVentana = capCreateCaptureWindow( hb_parc( 1 ), (DWORD) hb_parnl(
2 ),
hb_parni( 3 ) ,hb_parni( 4 ),hb_parni(
5 ),hb_parni( 6 ),
(HWND) hb_parnl( 7 ), hb_parni(8) ) ;
hb_retnl( (LONG) hVentana ) ;
}
//HWND VFWAPI capCreateCaptureWindow( LPCTSTR lpszWindowName, DWORD
dwStyle, int x, int y, int nWidth, int nHeight, HWND hWnd, int
nID );
HB_FUNC( CONECTDRIVER )
{ hb_retl( SendMessage ( (HWND) hb_parnl( 1 ), WM_CAP_DRIVER_CONNECT,
hb_parni(2) , 0L) ); }
// hb_retl( capDriverConnect( (HWND) hb_parnl( 1 ), hb_parni(2) ) );
HB_FUNC( DISCONECTDRIVER )
{ hb_retl( capDriverDisconnect( (HWND) hb_parnl( 1 ) )); }
HB_FUNC( CAPPREVIEW )
{ hb_retl( capPreview( (HWND) hb_parnl( 1 ), hb_parl( 2 ) )); }
HB_FUNC( CAPPREVIEWSCALE )
{ hb_retl( capPreviewScale( (HWND) hb_parnl( 1 ), hb_parl( 2 ) )); }
HB_FUNC( CAPPREVIEWRATE )
{ hb_retl( capPreviewRate( (HWND) hb_parnl( 1 ), hb_parni( 2 ) )); }
HB_FUNC( CAPDLGVIDEODISPLAY )
{ hb_retl( capDlgVideoDisplay( (HWND) hb_parnl( 1 ) ) ); }
HB_FUNC( SETUPVIDEO )
{
CAPDRIVERCAPS CapDriverCaps;
CAPSTATUS CapStatus;
capDriverGetCaps( (HWND) hb_parnl( 1 ), &CapDriverCaps, sizeof
(CAPDRIVERCAPS));
// Video source dialog box.
if (CapDriverCaps.fHasDlgVideoSource)
capDlgVideoSource( (HWND) hb_parnl( 1 ) );
// Video format dialog box.
if (CapDriverCaps.fHasDlgVideoFormat)
{
capDlgVideoFormat( (HWND) hb_parnl( 1 ) );
// Are there new image dimensions?
capGetStatus( (HWND) hb_parnl( 1 ), &CapStatus, sizeof (CAPSTATUS));
// New Dimensions of Window
SetWindowPos( (HWND) hb_parnl( 1 ), NULL, 0, 0,
CapStatus.uiImageWidth, CapStatus.uiImageHeight, SWP_NOZORDER |
SWP_NOMOVE);
// If so, notify the parent of a size change.
}
// Video display dialog box.
if (CapDriverCaps.fHasDlgVideoDisplay)
capDlgVideoDisplay( (HWND) hb_parnl( 1 ) );
}
HB_FUNC( CAPGETDRIVERS )
{
char szDeviceName[80];
char szDeviceVersion[80];
int wIndex;
// Maximos dispositivos a tratar. Del 0...9
hb_reta(10);
for (wIndex = 0; wIndex < 10; wIndex++)
{
if ((HWND)capGetDriverDescription(wIndex, szDeviceName, sizeof
(szDeviceName), szDeviceVersion, sizeof (szDeviceVersion)))
{
// Append name to list of installed capture drivers
// and then let the user select a driver to use.
//MessageBox( GetActiveWindow(), szDeviceName, szDeviceVersion,
MB_SYSTEMMODAL );
//hb_storc( szDeviceName , -1, ( wIndex + 1 ) ); xHB
hb_storc( szDeviceName, ( wIndex + 1 ) );
}
}
}
HB_FUNC( CAPFILESAVEDIB )
{ hb_retl( capFileSaveDIB( (HWND) hb_parnl( 1 ), hb_parc(2) ) ); }
#PRAGMA ENDDUMP
"Ingo" wrote in message news:[email=52986761@svctag-j7w3v3j....]52986761@svctag-j7w3v3j....[/email]
Dear Bingen,
thank you for the code. I will try it now.
Best regards
Ingo
"Bingen Ugaldebere" <
bingen@bisoft.es> schrieb im Newsbeitrag
news:52984de4$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Can I Help you with this code ?
>
> Regards.
>