Activate a (COM Interop based) ActiveX contol using registration free com

Posted by embnut on Stack Overflow See other posts from Stack Overflow or by embnut
Published on 2010-05-17T17:30:12Z Indexed on 2010/05/18 14:51 UTC
Read the original article Hit count: 415

I have a (COM Interop based) ActiveX contol that I am trying to use with registration free com. When the control loads the control is inactive (does not responds to events, control not fully rendered etc).

After much search I discovered that COM objects using reg-free-com use the miscStatus attribute to set the initial state to get correctly activated. I know how to use it with a comClass which corresponds to a native COM Object.

1) What is the equivalent of the following for clrClass element which corresponds to a COM-interop object?

<comClass clsid="{qqqqqqqq-wwww-eeee-rrrr-00C0F0283628}"               
    tlbid="{xxxxxxxx-yyyy-zzzz-aaaa-0000F8754DA1}"               
    threadingModel="Both"                  
    progid="SomeCompany.SomeOleControl"               
    description="Some ActiveX Control"
    miscStatus="recomposeonresize,insideout,activatewhenvisible,nouiactivate" >

2) The COM client I am using is Visual FoxPro. If the (1) is not possible what can I do in VFP to activate the inactive ActiveX control. (I dont mind VB or C# input too if I can use it to find the equivalent foxpro)

Currently I tried the following

this.AddObject('OleControl1', 'oleControl', 'SomeCompany.SomeOleControl')
this.OleControl1.AutoActivate = 3
this.OleControl1.Visible = .T.
this.OleControl1.SetFocus

But I the OleControl1 gets focus before passing events like mouse click to its subelements. So I have to click twice on it to do the necessary action, any time it does not have focus. I would like the control to act as if the "nouiactivate" of the miscStatus value is set.

3) Is there any other way of accomplishing what I want to do?

Hans Passant, here is the listing of current Assembly.dll.manifest. The formatting in the comment made it unreadable.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity name="Assembly" 
 version="1.0.0.0" type="win32" publicKeyToken="wwwwwwwwwwwwwwww"/>
<clrClass
 name="SomeCompany.SomeOleControl"
 clsid="{qqqqqqqq-wwww-eeee-rrrr-00C0F0283628}"
 progid="SomeCompany.SomeOleControl"
 threadingModel="Both"/>
<file name="Assembly.tlb">
 <typelib
  tlbid="{xxxxxxxx-yyyy-zzzz-aaaa-0000F8754DA1}"
  version="1.0"
  helpdir=""
  flags="hasdiskimage"/>
 </file>
</assembly>

© Stack Overflow or respective owner

Related posts about regfreecom

Related posts about activation