Symbol item expected from hb_vbDo()
yo posso hacer algo para cuando der este erro return NIL i no feche meu sistema ?
#define HB_OS_WIN_32_USED
#include <windows.h>
#include "hbapi.h"
#include "MsFinger.h"
static PHB_DYNS pEventStatus = NULL;
static PHB_DYNS pEventImage = NULL;
static
PHB_DYNS FindSymbol( char * cFuncName )
{
PHB_DYNS p = hb_dynsymFindName(cFuncName);
if ( !p )
{
char err[255] = {0};
sprintf( err, "FindSymbol: Undefined symbol '\%s' unable to continue!", cFuncName );
hb_errInternal( 7042, err, "", "" );
}
return p;
}
static
void PushSymbol( PHB_DYNS pPointer )
{
#if defined(HB_NEW_PUSH_SYMBOL)
hb_vmPushSymbol( hb_dynsymSymbol( pPointer ) );
#else
hb_vmPushSymbol( pPointer->pSymbol );
#endif
}
static
void WriteEvent(char *idSensor, int event)
{
PushSymbol(pEventStatus);
hb_vmPushNil();
hb_vmPushInteger(event);
hb_vmPushString( idSensor, strlen(idSensor) );
hb_vmDo( 2 );
}
static
void WriteLog(char *msg)
{
PushSymbol(pEventStatus);
hb_vmPushNil();
hb_vmPushInteger( GR_LOG );
hb_vmPushString( msg, strlen(msg) );
hb_vmDo( 2 );
}
static
void CALLBACK FingerEventHandler(char* idSensor, GRCAP_FINGER_EVENTS event)
{
WriteLog("Just signals that a finger event ocurred.");
WriteEvent(idSensor, event);
}
static
void CALLBACK ImageEventHandler(char* idSensor, unsigned int width, unsigned int height, unsigned char* rawImage, int res)
{
PHB_ITEM pImage;
PHB_ITEM pTemplate;
char tpt[GR_MAX_SIZE_TEMPLATE];
int Ret, Size;
WriteLog("Signaling that an image event occurred.");
Size = GR_MAX_SIZE_TEMPLATE;
Ret = GrExtract( rawImage, width, height, res, tpt, &Size, GR_DEFAULT_CONTEXT );
if (Ret < 0 )
Size = 0;
pImage = hb_itemNew( NULL );
hb_itemPutCL( pImage, rawImage, width*height );
pTemplate = hb_itemNew( NULL );
if (Size)
{
hb_itemPutCL( pTemplate, (char *)tpt, Size );
} else {
hb_itemPutC( pTemplate, "" );
}
PushSymbol(pEventImage);
hb_vmPushNil();
hb_vmPushString( idSensor, strlen(idSensor) );
hb_vmPush( pTemplate );
hb_vmPush( pImage );
hb_vmPushLong( (LONG) width );
hb_vmPushLong( (LONG) height );
hb_vmPushInteger( res );
hb_vmDo( 6 );
hb_itemRelease( pImage );
hb_itemRelease( pTemplate );
}
static
void CALLBACK StatusEventHandler(char* idSensor, GRCAP_STATUS_EVENTS event)
{
WriteEvent( idSensor, event );
if (event == GR_PLUG)
{
WriteLog("Start capturing from plugged sensor.");
GrCapStartCapture(idSensor, &FingerEventHandler, &ImageEventHandler);
} else if (event == GR_UNPLUG)
{
WriteLog("Stop capturing from unplugged sensor.");
GrCapStopCapture(idSensor);
}
}
//############################################################################//
static
void GrInitalizeSymbols()
{
pEventStatus = FindSymbol( "GR_STATUSEVENTHANDLER" );
pEventImage = FindSymbol( "GR_IMAGEEVENTHANDLER" );
}
HB_FUNC( GRINITIALIZE )
{
if (!pEventStatus)
GrInitalizeSymbols();
hb_retni( GrInitialize() );
}
HB_FUNC( GRFINALIZE )
{
hb_retni( GrFinalize() );
}
HB_FUNC( INITIALIZEGRCAP )
{
hb_retni( GrCapInitialize(&StatusEventHandler) );
}
HB_FUNC( GRCAPFINALIZE )
{
hb_retni( GrCapFinalize() );
}
HB_FUNC( GRIDENTIFYPREPARE )
{
char *templateQuery = hb_parc(1);
int context = hb_parni(1);
hb_retni( GrIdentifyPrepare(templateQuery, context) );
}
HB_FUNC( GRIDENTIFY )
{
char *templateReference = hb_parc(1);
int identifyScore = hb_parni(2);
int context = hb_parni(3);
hb_retni( GrIdentify (templateReference, &identifyScore, context ));
hb_storni( identifyScore, 2 );
}
HB_FUNC( GRVERIFY )
{
char *queryTemplate = hb_parc(1);
char *referenceTemplate = hb_parc(2);
int verifyScore = hb_parni(3); // by reference - @
int context = hb_parni(4);
hb_retni( GrVerify(queryTemplate, referenceTemplate, &verifyScore, context) );
hb_storni( verifyScore, 3 );
}
HB_FUNC( GRCAPSAVERAWIMAGETOFILE )
{
unsigned char* rawImage = (unsigned char*) hb_parc(1);
unsigned int width = (unsigned int) hb_parnl(2);
unsigned int height = (unsigned int) hb_parnl(3);
char* fileName = hb_parc(4);
GRCAP_IMAGE_FORMAT imageFormat = ( ISNUM(5) ? hb_parni(5) : 501 );
hb_retni( GrCapSaveRawImageToFile(rawImage, width, height, fileName, imageFormat) );
}
/******************************************************
* *
* GrFinger Biometric Fingerprint Library *
* *
* *
******************************************************/
#include "windows.h"
#include "MsFinger.ch"
#define DLLIMPORT __declspec(dllimport) int __stdcall
#define CALLBACK __stdcall
typedef int GRCAP_STATUS_EVENTS;
typedef int GRCAP_FINGER_EVENTS;
typedef int GRCAP_IMAGE_FORMAT;
typedef long BITMAP_HANDLE;
typedef void CALLBACK GRCAP_STATUS_EVENT_PROC(char* idSensor, GRCAP_STATUS_EVENTS event);
typedef void CALLBACK GRCAP_FINGER_EVENT_PROC(char* idSensor, GRCAP_FINGER_EVENTS event);
typedef void CALLBACK GRCAP_IMAGE_EVENT_PROC(char* idSensor, unsigned int width, unsigned int height, unsigned char* rawImage, int res);
DLLIMPORT
GrCapInitialize(GRCAP_STATUS_EVENT_PROC *StatusEventHandler);
DLLIMPORT
GrCapFinalize();
DLLIMPORT
GrCapStartCapture(char* idSensor, GRCAP_FINGER_EVENT_PROC *FingerEventHandler, GRCAP_IMAGE_EVENT_PROC *ImageEventHandler);
DLLIMPORT
GrCapStopCapture(char* idSensor);
DLLIMPORT
GrExtract(unsigned char *rawimage, int width, int height, int res, char *tpt, int *tptSize, int context);
DLLIMPORT
GrInitialize();
DLLIMPORT
GrFinalize();
DLLIMPORT
GrVerify(char *queryTemplate, char *referenceTemplate, int *verifyScore, int context);
DLLIMPORT
GrIdentifyPrepare (char *templateQuery, int context);
DLLIMPORT
GrIdentify(char *templateReference, int *identifyScore, int context);
DLLIMPORT
GrCapSaveRawImageToFile(unsigned char* rawImage, unsigned int width, unsigned int height, char* fileName, GRCAP_IMAGE_FORMAT imageFormat);
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 59 guests