Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing MSComm Control
Message
From
18/07/2000 10:04:05
 
 
To
18/07/2000 08:15:30
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00393493
Message ID:
00393771
Views:
89
Hi Tom,
I recently encountered a similar situation. Refer to Thread #386187 to see those details.

>I am in the beginning stages of trying to create a COM object that will be used inside an ASP page. I can instantiate the base MSComm control via the following syntax:
>
>oComm = CREATEOBJECT('mscommlib.mscomm')
>
>I was trying to subclass the control to add method code to the oncomm event. I don't need or want to add the subclass to a form...

Because you dont want to have a form, using the OleControl isn't an option because it has to exist within a form. In this context, I would recommend you take a look at VFPCOM. If all you need is to add code to a method of the control, VFPCOM will allow you a viable solution via its BindEvents method.

>
>>How are you trying to instantiate it? You have to add the OleCOntrol class to a form using AddObject() or NewObject(). It won;t instantiate otherwise.
>>
>>>When trying to instantiate a subclass of the MSCommLib.MSComm control I get the following error: Object class is invalid for this container. Why can't I create a workable subclass of MSComm?
>>>
>>>The code below was extracted from the VFP class browser. When I
>>>looked at the properties sheet I did find the OleClass = MSCommLib.MSComm.1.

If for some reason you feel you need to use the OleControl, try this:

DEFINE CLASS myform AS Form
ADDOBJECT oMsComm As MsComm
PROCEDURE oMsComm.OnComm() && this can go here
***Your code here
ENDPROC
ENDDEFINE
DEFINE CLASS MsComm As OleControl
OLECLASS='MsCommLib.MsComm'
PROCEDURE OnComm() && or it can go here
***Your code here
ENDPROC
ENDDEFINE

Jon
Previous
Reply
Map
View

Click here to load this message in the networking platform