ActiveX control loading but not activating correctly (only when using in Reg Free COM)

Posted by embnut on Stack Overflow See other posts from Stack Overflow or by embnut
Published on 2010-05-20T19:34:55Z Indexed on 2010/05/20 22:40 UTC
Read the original article Hit count: 409

Filed under:
|
|
|
|

I have an ActiveX control (created using C#) that I am adding to a form in Visual FoxPro using late binding. It works without problems when I register the control.

I want to use reg free COM and created necessary manifest files. Now it load and displays in an inactive state until I double click or programatically activate it. I don't think it has anything to do with the reg free com manifest files. However is there something I need to do to set it up before/after making the late binding call AddObject()?

this.AddObject('OleControl1', 'oleControl', 'SomeCompany.SomeOleControl') 

When I check the OleTypeAllowed Property of the OleControl created by AddObject() it is 1 (Embedded OLE object) instead of -2 (ActiveX object). So the OleControl got instantiated to the wrong type.

I also tried the following:

  1. DEFINE(d) a subclass of OleControl and set the property OleTypeAllowed = -2. Used late binding to load the control. It did not work as required. The OleTypeAllowed came back as 1
  2. Registered the ActiveX control. Added the ActiveX control to the project as a subclass using the visual editor. Unregistered the control. Used late binding to load the control. It did not work as required. The OleTypeAllowed came back as 1.

Is it possible to load the OleControl as a ActiveX control? Any input from VB that I can convert to FoxPro would also be appreciated.

© Stack Overflow or respective owner

Related posts about foxpro

Related posts about vb6