Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems reading from serial port with MSCOMM32
Message
 
To
05/11/1998 00:49:26
Paul Harker
Harker Enterprises, Inc.
Idaho Falls, Idaho, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00154570
Message ID:
00154781
Views:
17
>>Hello everybody.
>>I am trying to use the MSCOMM32 control to connect to
>>a service. I am suppose to connect, wait for an
>>"Send ID now." and send what I need, I made a function
>>to do that,it works fine, but when I call then function from within
>>the application it never works.
>>The problem is that I am working in the darkness, because
>>I don't know how to read the "Send ID now" after I connect.
>The RS232 control has different modes to read data from the comm port. You can read a number of characters at a time, or the full buffer(better check that no data has been set for a certain length of time). Also, You need to know the issues (bugs) in woring with the control (ie, buffer size more than 2K, and parity replace character issues). Make sure you have the help file with all the info on MSCOMM32.OCX. It shipped with VFP 3.0, but not 5.0. Let me know if you need some sample code.

Thanks Paul, I have the help file. Let me show you a short example of the code
may be it will bring some light :

MyCommObj=CREATEOBJECT("mscommlib.mscomm")
MyCommObj.commport=1
MyCommObj.settings="1200,N,8,1"
MyCommObj.portopen=.T.
MyCommObj.inputbuffer=0 && Read the entire buffer
MyCommObj.rthreshold=8 && Generate the OnComm event every characters
&& This doesn't seems to affect to much in my case

MyCommObj.Output="ATDT 555-1212"+CHR(13) && Dial 555-1212

DO WHILE .T. && Delay until connected to the host
m.BufferLenthg=MyCommObj.InBufferCount

IF m.BufferLenght>0
m.Input_Text= m.Input_Text+MyCommObj.Input
IF "CONNECT" $ m.Input_text
EXIT
ENDIF
ENDIF

ENDO

Until here I am ok, after this I have to wait for
the host computer to say something like "Enter user name :"
and this doesn't show in the "Input" property, is not suppose
to show automatically ?, do I have to tell it in some way
to receive the characters ?
I tried to send the "username" after certain amount of time,
it worked fine using the function from the command line,
but when I call the function from an application it just
doesn't work.

Thanks for your help.
Luis Guzman, MCP
"The only glory most of us have to hope for
is the glory of being normal." Katherine Fulleton Gerould
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform