开发者

OleControl instantiated to wrong type - only when using in Reg Free COM?

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 grammatically 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 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.


You probably have the miscStatusContent attribute wrong. This a snippet from a VB6 app manifest we deploy:

<file name="External\COMCTL32.OCX">
    <typelib tlbid="{6B7E6392-850A-101B-AFC0-4210102A8DA7}" version="1.3" flags="control,hasdiskimage" helpdir="" />
    <comClass clsid="{9ED94440-E5E8-101B-B9B5-444553540000}" tlbid="{6B7E6392-850A-101B-AFC0-4210102A8DA7}" progid="COMCTL.TabStrip.1" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
        <progid>COMCTL.TabStrip</progid>
    </comClass>
    ....
</file>

Notice that miscStatus has to be explicitly cleared.

We are using UMMM for manifest creation in our automated builds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜