I have a client that is adding a barcode card reader to a turn style access
gate. The reader vendor provided a dll with examples for VB. I have used
3rd party dll's before but never to respond to an event initiated by the
dll.

I can connect to the reader and send data.

When I use there connection string I connect and can send data but return
.Null. as the return value instead of the 0 or 1
nRetval = 0
nGateNumber = 1
nIp = 10.10.1.2

nMyRetval = oreader.SendConnection(nGateNumber, nIp, nRetVal)

It requires the 3rd parameter but always returns .Null. (I have played with
various values of nRetVal although this is actually the retval. and the
value of nRetVal is always the value that I set it to after I call the
method.)

My other issue is I am not sure how to respond to the DataFromGate event
generated when a user scans there card.
I need to take the card number and look it up to see if they are paid up and
open or close the gate.

This will be called from form open on the front desk used to see details if
the account is past due or to manually open the gate. But for 98% of the
people the form will function without any user input other than the scan of
the card triggering the DataFromGate Event which sends the form the card
number.

I believe i need to create a wrapper for the DataFromGate method but and not
sure how to do that or add it to my existing form.


Thanks for your help.
Larry Oliver

All the documentation I have is included below.


dll Reference
Methods

CloseConnection ()

Description:

Closes the connection with the card reader or IPC.

SendData (short validEntry, short sound, short light, variant
textLine1,variant textLine2, variant textLine3, short time)

Description: Controls the connected gate. Can be used to open the gate, keep
it closed and display messages.

Parameters:

validEntry - The action to be taken by the gate. 0 Keep the gate closed, 1
open the gate.

sound - The type of sound to be made by the gate. 0 sound off, 1 valid, 2
not valid, 3 error

light - type of flashing for the light. 0 light off, 1 solid on, 2-13
various flashing speeds.

textLine1 - First line of text to be displayed on card reader.

textLine2 - Second line of text to be displayed on card reader.

textLine3 - Third line of text to be displayed on card reader if available.

time - Length of time in seconds for the gate to flash or display a message
before being reset.

SetConnection (long gateNumber, variant IPAddress, long returnValue)

Description: Connects to an IPC or individual card reader. Must be called
first in order to receive gate events and send data.

Parameters:

gateNumber - The number of the card reader, either 1 or 2, used for
compatibility with systems using an IPC.

IPAddress - A string containing the IP address of the individual card reader
or IPC.

returnValue - The result of the connection attempt. 1 successful, 0 failed.

Events

DataFromGate (String cardNumber)

Description: Called when the gate has received a card number scanned by a
member.

Parameters:

cardNumber - The number on the card scanned by the card reader.

Re: Using a Dll With an Event in a VFP Form. by Eric

Eric
Wed Sep 10 10:07:59 CDT 2003

Hello, Larry!
You wrote on Tue, 9 Sep 2003 14:43:22 -0600:

LDO> My other issue is I am not sure how to respond to the DataFromGate
LDO> event generated when a user scans there card.
LDO> I need to take the card number and look it up to see if they are paid
LDO> up and open or close the gate.

LDO> This will be called from form open on the front desk used to see
LDO> details if the account is past due or to manually open the gate. But
LDO> for 98% of the people the form will function without any user input
LDO> other than the scan of the card triggering the DataFromGate Event
LDO> which sends the form the card number.

LDO> I believe i need to create a wrapper for the DataFromGate method but
LDO> and not sure how to do that or add it to my existing form.

I think you are looking for the
DEFINE CLASS .... AS ... IMPLEMENTS command.
See VFP help on DEFINE CLASS for details on the IMPLEMENTS argument.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: Using a Dll With an Event in a VFP Form. by Wolfgang

Wolfgang
Wed Sep 10 11:00:19 CDT 2003

I would try
nMyRetval = oreader.SendConnection(nGateNumber, nIp, @nRetVal)

to give the parameter by reference
--
_________________

MFG
Wolfgang Schmale

MS Visual FoxPro MVP

--------------------------------
"Larry D. Oliver" <larry at lococorp dot com> schrieb im Newsbeitrag
news:OIWbEMxdDHA.1448@TK2MSFTNGP12.phx.gbl...
> I have a client that is adding a barcode card reader to a turn style
access
> gate. The reader vendor provided a dll with examples for VB. I have used
> 3rd party dll's before but never to respond to an event initiated by the
> dll.
>
> I can connect to the reader and send data.
>
> When I use there connection string I connect and can send data but return
> .Null. as the return value instead of the 0 or 1
> nRetval = 0
> nGateNumber = 1
> nIp = 10.10.1.2
>
> nMyRetval = oreader.SendConnection(nGateNumber, nIp, nRetVal)
>
> It requires the 3rd parameter but always returns .Null. (I have played
with
> various values of nRetVal although this is actually the retval. and the
> value of nRetVal is always the value that I set it to after I call the
> method.)
>
> My other issue is I am not sure how to respond to the DataFromGate event
> generated when a user scans there card.
> I need to take the card number and look it up to see if they are paid up
and
> open or close the gate.
>
> This will be called from form open on the front desk used to see details
if
> the account is past due or to manually open the gate. But for 98% of the
> people the form will function without any user input other than the scan
of
> the card triggering the DataFromGate Event which sends the form the card
> number.
>
> I believe i need to create a wrapper for the DataFromGate method but and
not
> sure how to do that or add it to my existing form.
>
>
> Thanks for your help.
> Larry Oliver
>
> All the documentation I have is included below.
>
>
> dll Reference
> Methods
>
> CloseConnection ()
>
> Description:
>
> Closes the connection with the card reader or IPC.
>
> SendData (short validEntry, short sound, short light, variant
> textLine1,variant textLine2, variant textLine3, short time)
>
> Description: Controls the connected gate. Can be used to open the gate,
keep
> it closed and display messages.
>
> Parameters:
>
> validEntry - The action to be taken by the gate. 0 Keep the gate closed,
1
> open the gate.
>
> sound - The type of sound to be made by the gate. 0 sound off, 1 valid, 2
> not valid, 3 error
>
> light - type of flashing for the light. 0 light off, 1 solid on, 2-13
> various flashing speeds.
>
> textLine1 - First line of text to be displayed on card reader.
>
> textLine2 - Second line of text to be displayed on card reader.
>
> textLine3 - Third line of text to be displayed on card reader if
available.
>
> time - Length of time in seconds for the gate to flash or display a
message
> before being reset.
>
> SetConnection (long gateNumber, variant IPAddress, long returnValue)
>
> Description: Connects to an IPC or individual card reader. Must be called
> first in order to receive gate events and send data.
>
> Parameters:
>
> gateNumber - The number of the card reader, either 1 or 2, used for
> compatibility with systems using an IPC.
>
> IPAddress - A string containing the IP address of the individual card
reader
> or IPC.
>
> returnValue - The result of the connection attempt. 1 successful, 0
failed.
>
> Events
>
> DataFromGate (String cardNumber)
>
> Description: Called when the gate has received a card number scanned by a
> member.
>
> Parameters:
>
> cardNumber - The number on the card scanned by the card reader.
>
>