Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bindevent crashes Fox
Message
 
 
To
31/05/2005 12:14:29
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01018697
Message ID:
01018750
Views:
13
>>>I see.
>>>Do I also need something like this in my class:
>>
>>>poComReader = ''
>>>PROCEDURE INIT
>>>	This.poComReader = CREATEOBJECT('MSCOMMLib.MSComm')
>>>	WITH This.poComReader
>>>		.CommPort = 8
>>>		.Settings = "9600,N,8,1"
>>>		.InputLen = 1
>>>		.PortOpen = .T.
>>>	ENDWITH	
>>>	EVENTHANDLER(This.poComReader, This)
>>>ENDPROC
>>
I never used this ActiveX control so cannot tell which settings you would need to get it to work.
> I think my question was about EVENTHANDLER. Where do I put that line? In the class definition?

You cannot instantiate COM object from inside of the Event Handler class. It should be a separate class
* Some other class, not the Event Handler
PROCEDURE INIT
	This.poComReader = CREATEOBJECT('MSCOMMLib.MSComm')
	oEvents = NEWOBJECT("MscommEventHandler")
	EVENTHANDLER(This.poComReader, oEvents)
	...
ENDPROC

DEFINE CLASS MscommEventHandler AS session

	IMPLEMENTS DMSCommEvents IN "c:\windows\system32\mscomm32.ocx"

	PROCEDURE DMSCommEvents_OnComm() AS VOID;
 				HELPSTRING "Occurs whenever the value of the CommEvent property changes."
	* add user code here
	ENDPROC

ENDDEFINE
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform