Information générale
Catégorie:
Contrôles ActiveX en VFP
Titre:
Can't Send Text Data from VFP5 to other computer
Please help...
I'm developing a program to capture text data from other computer running HyperTerminal.
I use the MSCOMM32.OCX in VFP5 and create a form to try it.
In the Init event of the form I put the following statements:
WITH THISFORM
.Olecontrol1.CommPOrt = 2
.Olecontrol1.settings = "2400,N,8,1"
.Olecontrol1.InputLen = 0
.Olecontrol1.PortOpen = .T.
ENDWITH
and in the OnComm event of OleControl1 I put the following:
*** OLE Control Event ***
*
#define _END_CHAR CHR(10)
IF THIS.CommEvent = 2
IF THIS.InBufferCount>0
lcString = THIS.Input
IF !(lcString == "")
THIS.Parent.cModemBuffer = THIS.Parent.cModemBuffer + lcString
i = 1
DO WHILE LEN(THIS.Parent.cModemBuffer)>0 AND ;
ASC(SUBSTR(THIS.Parent.cModemBuffer, i, 1))!=0
IF SUBSTR(THIS.Parent.cModemBuffer, i, 1) = _END_CHAR
THIS.Parent.cModemStr = THIS.Parent.cModemStr + LEFT(THIS.Parent.cModemBuffer, i)
THIS.Parent.cModemBuffer = SUBSTR(THIS.Parent.cModemBuffer, i+1)
*
THIS.Parent.ProcessModemStr()
i = 1
ELSE
i = i + 1
ENDIF
ENDDO
ENDIF
ENDIF
ENDIF
cModemBuffer and cModemStr are Properties that I create for the form.
ProcessModemStr is a method that I create for the form to process the cModemStr.
The problem is that I can not receive text data from other computer running HyperTerminal.
But I can send text data from a text box to other computer running HyperTerminal.
Thank's for your help and
Best Regards,
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement