Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to add oncomm event code?
Message
De
20/01/2002 17:30:37
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Where to add oncomm event code?
Divers
Thread ID:
00607512
Message ID:
00607512
Vues:
54
Hi All, I'm back to working with the mscomm control again, and in testing I have the following code in a prg that works. However, I need to add code to the oncomm event and I can't figure out where to add the code to it since I am not actually defining the class anywhere. Any ideas?
CLEAR
#define _END_CHAR CHR(10)
oComm = CREATEOBJ('MSCOMMLib.MSComm')
LOCAL lcData, lnStart, lldataready
lcDATA=''
lnStart = seconds()
llDataReady = .F.
With oComm
	.CommPort = 1
	.Settings = "9600,N,8,1"
	.inbuffersize=1024
	.InputLen = 0
	.RThreshold=1
	.SThreshold=1
	.PortOpen = .T.
	.output="~VER "+CHR(13)
	*Oncomm event of OComm should fire here and be processed
	*instead of code below
	DO WHILE .commevent#2 .and. SECONDS()-lnStart<3
		DOEVENTS()
	ENDDO
	DO WHILE .commevent=2
		lcData=ALLTRIM(lcData)+ALLTRIM(.input)
		IF LEN(ALLTRIM(lcdata))>0.or.LEN(ALLTRIM(.input))>0
			? "lcdata = "+lcDATA+ALLTRIM(.input)
		ENDIF
		IF !EMPTY(lcData).and.LEN(ALLTRIM(lcData))>4
			llDataReady = .T.
			Exit
		Endif
	ENDDO
	IF LEN(ALLTRIM(lcData))>0
		llDataReady=.T.
	ENDIF
	if llDataReady
		? "1St Send Phonetree Version: "+lcDATA
		? "1St Send Length of result: "+ALLTRIM(STR(len(lcDATA)))
	else
		? '1St Send Received no data!'
	ENDIF
ENDWITH
RETURN	
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform