Zhiqing Wan
Posts: 5
Joined: 2011-08-30
|
Hi,
could you please explain me how addin express intercepts the Click event on a particular tag (<input type="text"> for example) using ADXIEHTMLDocEvents ? Does any javascript injected into the DOM or any ActiveX object or plugin injected into the DOM?
Code example,
this.adxieHtmlDocEvents.SupportedEvents = AddinExpress.IE.ADXIEHTMLSupportedEvents.seInputText;
this.adxieHtmlDocEvents.OnClick += new AddinExpress.IE.ADXIEHTMLEventObjectEx_EventHandler(this.adxieHtmlDocEvents_OnClick);
Thanks,
Zhiqing |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Zhiqing,
All is simple. I use the IConnectionPoint interface to connect to events of HTML elements.
internal bool ConnectTo(object htmlElement)
{
lock (this)
{
IntPtr lpDisp = IntPtr.Zero;
ComTypes.IConnectionPoint m_oConnectionPoint = null;
try
{
ComTypes.IConnectionPointContainer oConnPointContainer =
(ComTypes.IConnectionPointContainer)htmlElement;
oConnPointContainer.FindConnectionPoint(ref guid, out m_oConnectionPoint);
if (m_oConnectionPoint != null)
{
int m_Cookie = 0;
m_oConnectionPoint.Advise(this, out m_Cookie);
//m_oConnectionPoint.Advise(((IRemoteModule2)this.module).ModuleDisp, out m_Cookie);
if (m_Cookie > 0)
{
m_Cookies.Add(m_Cookie);
m_oConnectionPoints.Add(m_oConnectionPoint);
m_HtmlElements.Add(htmlElement);
return true;
}
Marshal.ReleaseComObject(m_oConnectionPoint);
}
}
catch
{
}
}
return false;
} |
|