Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing MSComm Control
Message
From
18/07/2000 14:25:52
 
 
To
18/07/2000 13:37:50
Gregg Geeslin
Kwajalein Range Services
Apo, California, United States
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00393493
Message ID:
00393958
Views:
14
Hi Gregg,

>Hi Tom, Larry,
>
>I played around with this control a bit yesterday. The only way I could get it to run for me was to drop it on a form. I didn't have any luck doing an AddObject() or NewObject() after the form was instantiated. I didn't have any luck with _Screen.AddObject(), either. I dragged it off the Forms Control menu onto an empty form and it worked fine. I was able to save the form with the MSComm object on it as a class and then instantiating it from a command line. Using the Class Browser to view the code, the code looked like this:
>
>**************************************************
>*-- Class: temp (c:\temp\temp1.vcx)
>*-- BaseClass: form
>*-- Time Stamp: 07/18/2000 12:12:07 PM
>*
>DEFINE CLASS temp AS form
>
>
> AutoCenter = .T.
> Visible = .T.
> LockScreen = .F.
> Name = "Form1"
>
>
> ADD OBJECT olecontrol1 AS olecontrol WITH ;
> Top = 0, ;
> Left = 0, ;
> Height = 100, ;
> Width = 100, ;
> Visible = .F., ;
> Name = "Olecontrol1",;
OleClass='MsCommLib.MsComm'

>
>
>ENDDEFINE
>*
>*-- EndDefine: temp
>**************************************************
>
>* I took this code above and saved it to temp.prg, then
>SET PROCEDURE TO Temp.prg ADDITIVE
>x = NEWOBJECT('Temp')
>*
>* Here a funky looking dialog came up.

The reason you got this dialog is because the OleControl doesnt know what object to load. Insert the code I added above (it's in bold), and you wont get this and the MsComm control will be loaded.

>* I selected 'Insert Control', picked the Communications Control and
>x.Show()
>* And there was the form.
>?x.controls[1].name
>?x.controls[1].baseclass
>*
>Perhaps you missed seeing an Add Object command in your example's parent class?
>I'll have to play around with this some more later. I'd like to know how to do this programmatically.
>
>HTH,
>
>Gregg
>gregg@wsacorp.com

FWIW, check out the other message I posted about this thread.

Jon
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform