Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MScomm class definition
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01018748
Message ID:
01018792
Vues:
13
>Mark,
>
>You can do this:
>
>
>loForm = Createobject('Form')
>
>with loForm as Form
>	.addobject('myComm', 'ComReader')
>	.Show(1)
>endwith
>
>DEFINE CLASS ComReader AS OLEControl
>	OLECLASS = 'MSCOMMLib.MSComm.1'
>	poComReader = NULL
>	pclastreading = ''
>	FUNCTION mInitialize
>		susp
>		*This.poComReader = CREATEOBJECT('MSCOMMLib.MSComm')
>		WITH This
>			.Rthreshold = 1
>			.CommPort = 8
>			.Settings = "9600,N,8,1"
>			.InputLen = 20
>			.PortOpen = .T.
>		ENDWITH
>	ENDFUNC	
>	Procedure OnComm
>		lcInput = CHRTRAN(This.Input, CHR(13),  '')
>		lcInput = CHRTRAN(lcInput, CHR(10),  '')
>		lcInput = CHRTRAN(lcInput, '*',  '')
>		*!* Check if it's the same scan then ignore
>		IF This.pcLastReading == lcInput
>			RETURN ''
>		ENDIF	
>		This.pcLastReading = lcInput
>		RETURN lcInput
>	ENDPROC
>	FUNCTION Destroy
>		if This.PortOpen
>			This.PortOpen = .F.
>		endif
>	ENDFUNC	
>ENDDEFINE
>
>
>
>Note that I changed the destroy to avoid it firing an error.

But where is EVENTHANDLER?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform