Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to read string from serial port for bar code app
Message
De
23/05/2002 07:16:28
 
 
À
01/05/2002 11:56:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00651375
Message ID:
00660336
Vues:
13
I recently integrated a proximity card reader into one of my VFP apps. Let's see if I can point you in the right direction.
First I would worry about fopen() - instead look at MSCOMM32 activex

I opened and closed like this:
***************************************************************

IF This.CAPTION="Open Port"
if This.parent.Olecontrol1.portopen=.T.
This.parent.Olecontrol1.portopen=.F.
endif
This.parent.Olecontrol1.portopen=.T.
This.CAPTION = "Close Port"
ELSE
if This.parent.Olecontrol1.portopen=.F.
This.parent.Olecontrol1.portopen=.T.
endif
This.parent.Olecontrol1.portopen=.F.
This.CAPTION = "Open Port"
ENDIF
************************************************************

A little loose, but I only wanted the port open when needed. You can dump this input most anywhere. Then I set a limit of how much data to read. Variable input1 receives the input, then I go on the manupliate the string.

************************************************************
input1 = This.parent.Olecontrol1.INPUT
FOR i = 1 TO LEN(inval1)
input2 = ASC(SUBSTR(input1, i, 1))
This.Parent.Edit1.VALUE=This.Parent.Edit1.VALUE+;
" "+ALLTRIM(STR(input2))+" "
ENDFOR
************************************************************

Hope this helps.
MD
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform