Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Object from ActiveX
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Create Object from ActiveX
Miscellaneous
Thread ID:
00183418
Message ID:
00183418
Views:
102
I was trying to create an object from an OLEControl ActiveX class I defined. I was getting the error 'Object class is invalid for this container.'. The only way I got it to work was putting it in a Form Class and then I could access the properties, methods and events for the OLE Active control. I also tried adding the OLEControl object to other control types but got the same error when I tried to create an object. I was using the GUI for all this then decided to try it in code. The code below illustrates what I was trying to do. Note when I define the class thecal as any other than a form type I get the error. What am I doing wrong? Thanks in advance.

okcal=createobject("thecal")
okcal.show()

DEFINE CLASS thecal as FORM (*NOTE: FORM ONLY WORKS*)
windowtype = 1

ADD OBJECT ocal AS ocal WITH ;
Top = 0, ;
Left = -4, ;
Height = 180, ;
Width = 269, ;
Name = "Ocal"

ENDDEFINE



DEFINE CLASS ocal AS olecontrol
Height = 182
Width = 314
Name = "ocal"
oleclass="MSACAL.MSACALCtrl.7"
oletypeallowed = 1
ENDDEFINE
Michael Garcia
Next
Reply
Map
View

Click here to load this message in the networking platform