Fórum Interceptar um evento externo no Delphi. #414396
22/03/2012
0
É o seguinte. Estou desenvolvendo um programa para se comunicar com um Terminal de controle de acesso com leitor biométrico, modelo F7, do fabricante ZKSoftware. Estou utilizando o SDK do fabricante. Importo o SDK (Conjutno de dlls) como um objeto ActiveX que gera um .pas. Este arquivo possui o seguinte:
// *********************************************************************//
// DispIntf: _IZKEMEvents
// Flags: (4096) Dispatchable
// GUID: {CF83B580-5D32-4C65-B44E-BEDC750CDFA8}
// *********************************************************************//
_IZKEMEvents = dispinterface
[{CF83B580-5D32-4C65-B44E-BEDC750CDFA8}]
procedure OnVerify(UserID: Integer); dispid 9;
Quando o aparelho faz a leitura da digital, ele dispara um evento (RealTime) que deve ser interceptado automaticamente pelo Delphi. A duvida é como disparar esse evento no Delphi? No demo em C#, o código é o seguinte:
if (axCZKEM1.RegEvent(iMachineNumber, 65535))//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
{
this.axCZKEM1.OnVerify+=new zkemkeeper._IZKEMEvents_OnVerifyEventHandler(axCZKEM1_OnVerify);
}
//After you have placed your finger on the sensor(or swipe your card to the device),this event will be triggered.
//If you passes the verification,the returned value userid will be the user enrollnumber,or else the value will be -1;
private void axCZKEM1_OnVerify(int iUserID)
{
lbRTShow.Items.Add(RTEvent OnVerify Has been Triggered,Verifying...);
if (iUserID != -1)
{
lbRTShow.Items.Add(Verified OK,the UserID is + iUserID.ToString());
}
else
{
lbRTShow.Items.Add(Verified Failed... );
}
}
No manual do SDK, o exemplo em VB é:
5.6 OnVerify
Event prototype as follows:
HRESULT OnVerify([in] LONG UserID);
Purpose: When the fingerprint verification is successful, trigger this event
Variable meaning: UserID: the user number. If this value is less than 0, means that the user does not exist.
Alguém sabe como posso fazer isso no Delphi?
Átila Medeiros
Curtir tópico
+ 0Posts
23/03/2012
Leonardo Xavier
Gostei + 0
23/03/2012
Leonardo Xavier
tenta assim
onverify(seu_user);
Gostei + 0
24/03/2012
Átila Medeiros
Seguinte, importando o componente ADO e usando o evento do componente da certo.
A outra duvida que tenho, é com relação a criar uma class herdando do componente(Ex: Terminal = Class (TCZKEM)) ADO. Como faria pra usar os eventos do objeto instanciado? Porque pelo componente, vou lá na aba Event, escolho o evento Realtime e crio o procedure.
Valeu.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)