<?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[late bound einer VB ActiveX DLL]]></title><description><![CDATA[<p>Hallo Leute!</p>
<p>ich möchte eine <strong>nicht registrierte ActiveX DLL (VB)</strong><br />
in mein Programm einbinden(<strong>late bound</strong>).</p>
<pre><code>EXPORT (VB ActiveX DLL)
DllCanUnloadNow
DllGetClassObject
DllRegisterServer
DllUnregisterServer
</code></pre>
<p>Ist das überhaupt möglich?</p>
<p>In VB sieht mache ich es so:</p>
<pre><code>'Teil 1
'registrieren der DLL
  hDLL = LoadLibrary(&quot;myDLL.dll&quot;)
  hProc = GetProcAddress(hDLL, &quot;DllRegisterServer&quot;)
  hThread = CreateThread(ByVal 0, 0, ByVal hProc, ByVal 0, 0, hWSO)
  hWSO = WaitForSingleObject(hThread, 10000)
  CloseHandle hThread
  FreeLibrary hDLL

'Teil 2
'jetzt einen Verweis erstellen
  dim vbDLL as Object
  Set vbDLL = CreateObject(&quot;myDLL.clsDLL&quot;)
  vbDLL.test
  set vbDLL = nothing
</code></pre>
<pre><code class="language-cpp">mein C Projekt sieht so aus:

...
#include &lt;windows.h&gt;
...

bool registerDll(const char *filename)
    {
    HINSTANCE hInst = LoadLibrary(filename);
    if (!hInst)
    {
    return false;
    }
    else
    {
    	HRESULT (FAR STDAPICALLTYPE * lpDllEntryPoint)(void); 
    (FARPROC&amp;)lpDllEntryPoint = GetProcAddress(hInst, &quot;DllRegisterServer&quot;);
    if (!lpDllEntryPoint)
    {
    return false;
    }
    else
    {
    	 HRESULT hr = (*lpDllEntryPoint)(); 
    if (hr)
    {
    return false;
    }
    }
    FreeLibrary(hInst);
    }
    return true;
    }

int main(int argc, char* argv[])
{
	bool a;
	a = registerDll(&quot;prjdll.dll&quot;);
	if ( a == true) 
	{
		MessageBox(0, &quot;DLL registriert&quot;, &quot;&quot;, 0);
	}else{
		MessageBox(0, &quot;DLL nicht registriert&quot;, &quot;&quot;, 0);
	}

	// aber wie geht es weiter?????????
        // dim vbDLL as Object
        // Set vbDLL = CreateObject(&quot;myDLL.clsDLL&quot;)
        // vbDLL.test
        // set vbDLL = nothing

	return 0;
}
</code></pre>
<p>Ist das was ich vorhabe möglich???</p>
<p>P.S.: ich benutze M VC++ 6.0</p>
<p>Danke für eure Hilfe</p>
<p>mfg bump</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/124595/late-bound-einer-vb-activex-dll</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 08:38:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/124595.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 29 Oct 2005 05:53:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to late bound einer VB ActiveX DLL on Sat, 29 Oct 2005 05:53:36 GMT]]></title><description><![CDATA[<p>Hallo Leute!</p>
<p>ich möchte eine <strong>nicht registrierte ActiveX DLL (VB)</strong><br />
in mein Programm einbinden(<strong>late bound</strong>).</p>
<pre><code>EXPORT (VB ActiveX DLL)
DllCanUnloadNow
DllGetClassObject
DllRegisterServer
DllUnregisterServer
</code></pre>
<p>Ist das überhaupt möglich?</p>
<p>In VB sieht mache ich es so:</p>
<pre><code>'Teil 1
'registrieren der DLL
  hDLL = LoadLibrary(&quot;myDLL.dll&quot;)
  hProc = GetProcAddress(hDLL, &quot;DllRegisterServer&quot;)
  hThread = CreateThread(ByVal 0, 0, ByVal hProc, ByVal 0, 0, hWSO)
  hWSO = WaitForSingleObject(hThread, 10000)
  CloseHandle hThread
  FreeLibrary hDLL

'Teil 2
'jetzt einen Verweis erstellen
  dim vbDLL as Object
  Set vbDLL = CreateObject(&quot;myDLL.clsDLL&quot;)
  vbDLL.test
  set vbDLL = nothing
</code></pre>
<pre><code class="language-cpp">mein C Projekt sieht so aus:

...
#include &lt;windows.h&gt;
...

bool registerDll(const char *filename)
    {
    HINSTANCE hInst = LoadLibrary(filename);
    if (!hInst)
    {
    return false;
    }
    else
    {
    	HRESULT (FAR STDAPICALLTYPE * lpDllEntryPoint)(void); 
    (FARPROC&amp;)lpDllEntryPoint = GetProcAddress(hInst, &quot;DllRegisterServer&quot;);
    if (!lpDllEntryPoint)
    {
    return false;
    }
    else
    {
    	 HRESULT hr = (*lpDllEntryPoint)(); 
    if (hr)
    {
    return false;
    }
    }
    FreeLibrary(hInst);
    }
    return true;
    }

int main(int argc, char* argv[])
{
	bool a;
	a = registerDll(&quot;prjdll.dll&quot;);
	if ( a == true) 
	{
		MessageBox(0, &quot;DLL registriert&quot;, &quot;&quot;, 0);
	}else{
		MessageBox(0, &quot;DLL nicht registriert&quot;, &quot;&quot;, 0);
	}

	// aber wie geht es weiter?????????
        // dim vbDLL as Object
        // Set vbDLL = CreateObject(&quot;myDLL.clsDLL&quot;)
        // vbDLL.test
        // set vbDLL = nothing

	return 0;
}
</code></pre>
<p>Ist das was ich vorhabe möglich???</p>
<p>P.S.: ich benutze M VC++ 6.0</p>
<p>Danke für eure Hilfe</p>
<p>mfg bump</p>
]]></description><link>https://www.c-plusplus.net/forum/post/903169</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/903169</guid><dc:creator><![CDATA[bump]]></dc:creator><pubDate>Sat, 29 Oct 2005 05:53:36 GMT</pubDate></item><item><title><![CDATA[Reply to late bound einer VB ActiveX DLL on Sat, 29 Oct 2005 06:30:57 GMT]]></title><description><![CDATA[<p>- CoCreateInstance<br />
- QueryInterface auf IDispatch<br />
- Invoke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/903173</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/903173</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sat, 29 Oct 2005 06:30:57 GMT</pubDate></item><item><title><![CDATA[Reply to late bound einer VB ActiveX DLL on Sat, 29 Oct 2005 07:55:48 GMT]]></title><description><![CDATA[<p>Hallo MFK!</p>
<p>MFK schrieb:</p>
<blockquote>
<p>- CoCreateInstance<br />
- QueryInterface auf IDispatch<br />
- Invoke</p>
</blockquote>
<p><strong>CoCreateInstance</strong> benötigt doch ne CLSID oder?</p>
<p>aber</p>
<pre><code class="language-cpp">hresult=CLSIDFromProgID(OLESTR(&quot;prjdll.clsdll&quot;),&amp;clsid);
</code></pre>
<p>funktioniert nicht (es handelt sich hier um eine nicht registrierte ActiveX DLL.</p>
<p>mfg bump</p>
]]></description><link>https://www.c-plusplus.net/forum/post/903197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/903197</guid><dc:creator><![CDATA[bump]]></dc:creator><pubDate>Sat, 29 Oct 2005 07:55:48 GMT</pubDate></item><item><title><![CDATA[Reply to late bound einer VB ActiveX DLL on Sat, 29 Oct 2005 14:02:57 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/2803">@MFK</a>: bitte vergiss meinen letzten post <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
<p>ich habe jetzt folgendes zusammengestrickt:</p>
<pre><code class="language-cpp">...
  CoInitialize(NULL);

  CLSID clsid;
  IUnknown *pUnknown;
  IDispatch* m_pDispApp;
  IDispatch* m_pFunc_SUB;
  DISPID dispID;
  DISPPARAMS dp = { NULL, NULL, 0, 0 };  
  IDispatch* pFunc_SUB = NULL;
  VARIANT varRetVal;

  HRESULT hr = CLSIDFromProgID(L&quot;prjdll.clsdll&quot;, &amp;clsid);
  hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **) &amp;pUnknown);
  if (FAILED(hr)) {
    MessageBox(0, &quot;CoCreateInstance failed&quot;,&quot;&quot;, 0);
  }
  hr = pUnknown-&gt;QueryInterface(IID_IDispatch,(void**)&amp;m_pDispApp);
  if (FAILED(hr)) {
    MessageBox(0, &quot;QueryInterface failed&quot;,&quot;&quot;, 0);
  }

  LPOLESTR szCall = L&quot;subCallME&quot;; //ohne Parameterübergabe
  hr = m_pDispApp-&gt;GetIDsOfNames(IID_NULL, &amp;szCall, 1, LOCALE_SYSTEM_DEFAULT, &amp;dispID);
  hr = m_pDispApp-&gt;Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &amp;dp, &amp;varRetVal, NULL, NULL);

  m_pFunc_SUB = varRetVal.pdispVal;

  m_pDispApp = NULL;
  m_pFunc_SUB = NULL;
  pUnknown-&gt;Release();
  CoUninitialize();
  ...
</code></pre>
<p>ich rufe hier nur eine Procedure (subCallME) auf und es funktioniert <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
<strong>ABER</strong> wie kann ich der Procedure (siehe unten) einen Parameter übergeben?</p>
<pre><code>Public Sub subCallME(ByVal msg As String)
</code></pre>
<p>Falls im <strong>C code</strong> Fehler sein sollten, bitte darauf hinweisen!</p>
<p>Nochmals DANKE</p>
<p>mfg bump</p>
]]></description><link>https://www.c-plusplus.net/forum/post/903408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/903408</guid><dc:creator><![CDATA[bump]]></dc:creator><pubDate>Sat, 29 Oct 2005 14:02:57 GMT</pubDate></item><item><title><![CDATA[Reply to late bound einer VB ActiveX DLL on Sat, 29 Oct 2005 15:44:40 GMT]]></title><description><![CDATA[<p>Zum Verständnis, nachdem du DllRegisterServer() aufgerufen hat ist deine<br />
DLL registriert und dein Client greift wie jeder Andere COM-Client darauf zu.<br />
Was soll also die Behauptung du würdest auf eine nicht registrierte DLL<br />
zugreifen.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Wenn du mal die Beschreibung von Invoke() in der MSDN nachschlägst wirst du<br />
garantiert finden wie du die Parameter übergeben kannst. Ich wills jetzt nicht<br />
hierhin kopieren weil ich das für überflüssig halte.</p>
<p>Warum holst du dir nicht gleich das IDispatch-Interface im CoCreateInstance()-<br />
Aufruf, dann kannst du dir das nachfolgende QueryInterface() schenken. Dann<br />
hättest du vielleicht auch nicht das Leak aufgrund des fehlenden Release() für<br />
das IDispatch-Interface, denn auch der QueryInterface macht ein AddRef(), sofern<br />
korrekt implementiert.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<pre><code class="language-cpp">m_pFunc_SUB = varRetVal.pdispVal;
</code></pre>
<p>Was du hiermit beabsichtigst ist mir völlig schleierhaft.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/903462</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/903462</guid><dc:creator><![CDATA[Redhead]]></dc:creator><pubDate>Sat, 29 Oct 2005 15:44:40 GMT</pubDate></item></channel></rss>