开发者

InPlaceActivate on ATL control not called until mouse event

I have an ActiveX control written in C++ that I created with VS2008 and ATL. For the most part, it is a pretty standard (not modified much from the original template) control, except that instead of using IDispatchImpl, I have created my own IDispatchEx implementation. This control is only used in Internet Explorer, and I have been testing primarily with IE8.

Everything works great, except that for some reason, InPlaceActivate doesn't get called until I move the mouse over the region where the object tag is hosted in the browser; no window is created, no WM_CREATE message s开发者_如何学JAVAent, etc.

I have tried implementing DISPID_READYSTATE, but nothing seems to help. If I call InPlaceActivate(OLEIVERB_UIACTIVATE); from the SetClientSite method and it usually works, but that certainly isn't normally neccesary.

Why would this happen? How does the browser determine when to call InPlaceActivate (or whatever call triggers that)?

The tag used to embed the ATL control into the page is: <object id="plugin" type="application/x-vnd.FirebreathTemplatePlugin" width="300" height="300"></object>

You full source to the file can be found here: http://code.google.com/p/firebreath/source/browse/src/ActiveXPlugin/FBControl.h


I found the culprit. Aparently, the OLEMSIC_ACTIVATEWHENVISIBLE is used to auto-generate the %OLEMISC% variable in the .rgs file. However, I had overridden the default rgs handling to provide my own variables, and in the process one critical line got removed, which would have added a:

[CLSID]/MiscStatus/1 = s '131473'

to the registry. this aparently is used by the browser to decide how to initialize, and that value has OLEMISC_ACTIVATEWHENVISIBLE 'or'ed (|) into it. Added that back in and everything works again.


Have you tried returning OLEMISC_ACTIVATEWHENVISIBLE inside your IOleObject::GetMiscStatus() implementation?


If all you want is to ensure your window created for scripting, you can create the window earlier, as described in PRB: ActiveX Control Window Is Not Created Until Visible in Internet Explorer

See also IE Automatic Component Activation (Changes to IE ActiveX Update)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜