Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a better mscomm?
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00443243
Message ID:
00443596
Views:
13
The way I captured my OnComm event was to use VFPCOM's utilities.

* NOTE - code by command line entry.
*
* Create PRG file with class code that contains method onComm.
x = createobject("VFPCOM.COMUtil")
y = createobject("Mscommlib.Mscomm.1")
x.exportevents(y, "c:\myComm.prg")
x = .null.
y = .null.
**********************************
* myComm.prg would contain something like...
*
* DEFINE CLASS DMSCommEvents AS custom
*
*     PROCEDURE OnComm
*     * Add user code here
*     ENDPROC
*
*
*ENDDEFINE
*
**********************************
* 
* Then in your code, create the object from the myComm.prg file...
* 
x = createobject("VFPCOM.COMUtil")
y = createobject("Mscommlib.Mscomm.1")
myComm = createobject("DMSCommEvents") 
x.BindEvents(y, myComm)

* Now when oncomm your onComm will handle the event correctly.
x.UnBindEvents(y, myComm)
x = .null.
y = .null.
myComm = .null.
* Hope this helps.

George.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform