<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ermitteln einer EventID einer ActiveX zur Laufzeit]]></title><description><![CDATA[<p>Hallo!<br />
Ich habe eine ActiveX, die zur Laufzeit eine Instance einer anderen ActiveX erzeugt und dann anhand des<br />
Namens einer Methode mittels GetIDsOfNames(...) die jeweilige dispid (DispatchID) ermittelt.<br />
Mit der dispid kann dann mit invokehelper(..) die Methode aufgerufen werden.<br />
So weit so gut.<br />
Nun möchte ich aber auch die eventid eines bestimmten Events (Name:CollectEvent) ermitteln und musste feststellen,<br />
dass sich dies um einiges schwieriger gestaltet.<br />
Kann mir jemand helfen die eventid zu ermitteln oder mir zu mindest einen Ansatz geben, wie ich die ID geliefert bekomm?<br />
Danke schon einmal im Voraus.</p>
<p>Hier der code , wie ich die dispid bekomm und die Methoden aufrufe:</p>
<pre><code>....

CWnd m_ControlWrapper;
RECT rct = {0,0,5,50};

BOOL bStat=FALSE;
bStat= m_ControlWrapper.CreateControl(clsid, &quot;Spectrometer&quot;, WS_CHILD, rct, this, 1212, NULL, FALSE, NULL);

if (bStat == FALSE)
{
	MessageBox (&quot;Could not place control&quot;);
	return;
}

// Use the IUnknown of the control.
LPUNKNOWN pUnk = m_ControlWrapper.GetControlUnknown();

// From there get the IDispatch interface of control.
LPDISPATCH pInterface = NULL;

pUnk-&gt;QueryInterface(IID_IDispatch, (LPVOID*)&amp;pInterface);

CString CstrMethod = &quot;STATUS&quot;; 
BSTR BstrMethod = CstrMethod.AllocSysString();

DISPID dispid; 

// get the id of the method									
HRESULT hRet = pInterface-&gt;GetIDsOfNames(IID_NULL, &amp;BstrMethod, 1, LOCALE_SYSTEM_DEFAULT, &amp;dispid); 

// invoke the method
m_ControlWrapper.InvokeHelper(dispid, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);//InvokeHelper(0xc, DISPATCH_METHOD , VT_EMPTY, NULL, NULL);

....
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/153791/ermitteln-einer-eventid-einer-activex-zur-laufzeit</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Jul 2026 08:43:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/153791.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Jul 2006 13:54:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ermitteln einer EventID einer ActiveX zur Laufzeit on Thu, 20 Jul 2006 13:57:35 GMT]]></title><description><![CDATA[<p>Hallo!<br />
Ich habe eine ActiveX, die zur Laufzeit eine Instance einer anderen ActiveX erzeugt und dann anhand des<br />
Namens einer Methode mittels GetIDsOfNames(...) die jeweilige dispid (DispatchID) ermittelt.<br />
Mit der dispid kann dann mit invokehelper(..) die Methode aufgerufen werden.<br />
So weit so gut.<br />
Nun möchte ich aber auch die eventid eines bestimmten Events (Name:CollectEvent) ermitteln und musste feststellen,<br />
dass sich dies um einiges schwieriger gestaltet.<br />
Kann mir jemand helfen die eventid zu ermitteln oder mir zu mindest einen Ansatz geben, wie ich die ID geliefert bekomm?<br />
Danke schon einmal im Voraus.</p>
<p>Hier der code , wie ich die dispid bekomm und die Methoden aufrufe:</p>
<pre><code>....

CWnd m_ControlWrapper;
RECT rct = {0,0,5,50};

BOOL bStat=FALSE;
bStat= m_ControlWrapper.CreateControl(clsid, &quot;Spectrometer&quot;, WS_CHILD, rct, this, 1212, NULL, FALSE, NULL);

if (bStat == FALSE)
{
	MessageBox (&quot;Could not place control&quot;);
	return;
}

// Use the IUnknown of the control.
LPUNKNOWN pUnk = m_ControlWrapper.GetControlUnknown();

// From there get the IDispatch interface of control.
LPDISPATCH pInterface = NULL;

pUnk-&gt;QueryInterface(IID_IDispatch, (LPVOID*)&amp;pInterface);

CString CstrMethod = &quot;STATUS&quot;; 
BSTR BstrMethod = CstrMethod.AllocSysString();

DISPID dispid; 

// get the id of the method									
HRESULT hRet = pInterface-&gt;GetIDsOfNames(IID_NULL, &amp;BstrMethod, 1, LOCALE_SYSTEM_DEFAULT, &amp;dispid); 

// invoke the method
m_ControlWrapper.InvokeHelper(dispid, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);//InvokeHelper(0xc, DISPATCH_METHOD , VT_EMPTY, NULL, NULL);

....
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1101273</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1101273</guid><dc:creator><![CDATA[masanne]]></dc:creator><pubDate>Thu, 20 Jul 2006 13:57:35 GMT</pubDate></item></channel></rss>