Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recieve date from the COM: port into GET read
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00547800
Message ID:
00549151
Views:
15
Hi Sergey,


If you are developing your application using VFP 6, you can do it using the active X MSCOMM32, but using the FOX 2.6 you must do something like this:
procedure message
parameter wmessag

set library to "foxtools.fll" additive
OpenComm  = RegFn("OpenComm", "CII", "I", "USER.EXE")
WriteComm = RegFn("WriteComm", "ICI", "I", "USER.EXE")
CloseComm = RegFn("CloseComm", "I", "I", "USER.EXE")

BuildCommDCB = RegFn("BuildCommDCB", "C@C", "I", "USER.EXE")
SetCommState = RegFn("SetCommState", "@C", "I", "USER.EXE")
ReadComm     = RegFn("ReadComm", "I@CI", "I", "USER.EXE")

wport   = "COM1:"

idCom        = CallFn(OpenComm, wporta, 100, 100) && open the COM port

s       = wmessag
dcb     = Space(25)
a       = "BuildCommDCB"
wvaria  = wport+"9600,n,8,1"

=CallFn(BuildCommDCB, wvaria, @dcb)
b="SetCommState"
=CallFn(SetCommState, @dcb)

=CallFn(WriteComm, idCom, s, len(s)) && write to the COM port

=CallFn(CloseComm, idCom)

release library "foxtools.fll"

return
That sample procedure shows how to write to the COM port !

I don't have tested yeat the command to read from the COM port. But, I believe that all to be dued is use READCOMM parameter instead of WRITECOMM.

After receive the properly data, just use the KEYBOARD command to simulate the deal.

I hope that it will be usefull for you !

CLAUDIO
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform