Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to read string from serial port for bar code app
Message
From
23/05/2002 07:16:28
 
 
To
01/05/2002 11:56:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00651375
Message ID:
00660336
Views:
11
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
Previous
Reply
Map
View

Click here to load this message in the networking platform