<?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[DLL in Visual C++ 2005 Express Edition]]></title><description><![CDATA[<p>Hallo, vorweg muss ich sagen dass ich nicht unbedingt der Knüller in Sachen Programmieren mit Visual C++ 2005 bin. Meine Programmierkentnisse kommen eher aus dem bereich Elektronik (Mikrocontroller).<br />
Ich möchte nun ein Konsolenprogramm mit VC schreiben, welches über eine dll mit einem USB Gerät kommuniziert.</p>
<p>Ich habe leider keine Ahnung wie ich die DLL in mein Programm einbinden kann, ich habe nur folgenden Code aus einer Beispielanwendung der dll für Borland C++</p>
<pre><code class="language-cpp">HINSTANCE libHandle;
HANDLE myOutPipe;
HANDLE myInPipe;

void LoadDLL(void)
{
    libHandle = NULL;
    libHandle = LoadLibrary(&quot;mpusbapi&quot;);
    if(libHandle == NULL)
    {
        printf(&quot;Error loading mpusbapi.dll\r\n&quot;);
    }
    else
    {
        MPUSBGetDLLVersion=(DWORD(*)(void))\
                    GetProcAddress(libHandle,&quot;_MPUSBGetDLLVersion&quot;);
        MPUSBGetDeviceCount=(DWORD(*)(PCHAR))\
                    GetProcAddress(libHandle,&quot;_MPUSBGetDeviceCount&quot;);
        MPUSBOpen=(HANDLE(*)(DWORD,PCHAR,PCHAR,DWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBOpen&quot;);
        MPUSBWrite=(DWORD(*)(HANDLE,PVOID,DWORD,PDWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBWrite&quot;);
        MPUSBRead=(DWORD(*)(HANDLE,PVOID,DWORD,PDWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBRead&quot;);
        MPUSBReadInt=(DWORD(*)(HANDLE,PVOID,DWORD,PDWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBReadInt&quot;);
        MPUSBClose=(BOOL(*)(HANDLE))GetProcAddress(libHandle,&quot;_MPUSBClose&quot;);

        if((MPUSBGetDeviceCount == NULL) || (MPUSBOpen == NULL) ||
            (MPUSBWrite == NULL) || (MPUSBRead == NULL) ||
            (MPUSBClose == NULL) || (MPUSBGetDLLVersion == NULL) ||
            (MPUSBReadInt == NULL))
            printf(&quot;GetProcAddress Error\r\n&quot;);
    }//end if else
}//end LoadDLL
</code></pre>
<p>Wenn ich in der Hilfe von VC nach dll linken suche ist dort eine ähnliche Struktur als Beispiel angegeben.<br />
Wenn ich jedoch diesen Code in das Hauptprogramm einbinde kommt immer der Fehler<br />
Syntaxfehler: Fehlendes ';' vor Bezeichner 'hInst'<br />
gefolgt von zahllosen Folgefehlern.</p>
<p>Muss ich da noch irgendwelche Header einbinden, oder muss ich für HINSTANCE noch irgend einen Namespace angeben ??</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/172745/dll-in-visual-c-2005-express-edition</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 11:37:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/172745.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Feb 2007 22:20:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DLL in Visual C++ 2005 Express Edition on Wed, 07 Feb 2007 22:20:18 GMT]]></title><description><![CDATA[<p>Hallo, vorweg muss ich sagen dass ich nicht unbedingt der Knüller in Sachen Programmieren mit Visual C++ 2005 bin. Meine Programmierkentnisse kommen eher aus dem bereich Elektronik (Mikrocontroller).<br />
Ich möchte nun ein Konsolenprogramm mit VC schreiben, welches über eine dll mit einem USB Gerät kommuniziert.</p>
<p>Ich habe leider keine Ahnung wie ich die DLL in mein Programm einbinden kann, ich habe nur folgenden Code aus einer Beispielanwendung der dll für Borland C++</p>
<pre><code class="language-cpp">HINSTANCE libHandle;
HANDLE myOutPipe;
HANDLE myInPipe;

void LoadDLL(void)
{
    libHandle = NULL;
    libHandle = LoadLibrary(&quot;mpusbapi&quot;);
    if(libHandle == NULL)
    {
        printf(&quot;Error loading mpusbapi.dll\r\n&quot;);
    }
    else
    {
        MPUSBGetDLLVersion=(DWORD(*)(void))\
                    GetProcAddress(libHandle,&quot;_MPUSBGetDLLVersion&quot;);
        MPUSBGetDeviceCount=(DWORD(*)(PCHAR))\
                    GetProcAddress(libHandle,&quot;_MPUSBGetDeviceCount&quot;);
        MPUSBOpen=(HANDLE(*)(DWORD,PCHAR,PCHAR,DWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBOpen&quot;);
        MPUSBWrite=(DWORD(*)(HANDLE,PVOID,DWORD,PDWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBWrite&quot;);
        MPUSBRead=(DWORD(*)(HANDLE,PVOID,DWORD,PDWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBRead&quot;);
        MPUSBReadInt=(DWORD(*)(HANDLE,PVOID,DWORD,PDWORD,DWORD))\
                    GetProcAddress(libHandle,&quot;_MPUSBReadInt&quot;);
        MPUSBClose=(BOOL(*)(HANDLE))GetProcAddress(libHandle,&quot;_MPUSBClose&quot;);

        if((MPUSBGetDeviceCount == NULL) || (MPUSBOpen == NULL) ||
            (MPUSBWrite == NULL) || (MPUSBRead == NULL) ||
            (MPUSBClose == NULL) || (MPUSBGetDLLVersion == NULL) ||
            (MPUSBReadInt == NULL))
            printf(&quot;GetProcAddress Error\r\n&quot;);
    }//end if else
}//end LoadDLL
</code></pre>
<p>Wenn ich in der Hilfe von VC nach dll linken suche ist dort eine ähnliche Struktur als Beispiel angegeben.<br />
Wenn ich jedoch diesen Code in das Hauptprogramm einbinde kommt immer der Fehler<br />
Syntaxfehler: Fehlendes ';' vor Bezeichner 'hInst'<br />
gefolgt von zahllosen Folgefehlern.</p>
<p>Muss ich da noch irgendwelche Header einbinden, oder muss ich für HINSTANCE noch irgend einen Namespace angeben ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1224775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1224775</guid><dc:creator><![CDATA[noobc]]></dc:creator><pubDate>Wed, 07 Feb 2007 22:20:18 GMT</pubDate></item><item><title><![CDATA[Reply to DLL in Visual C++ 2005 Express Edition on Thu, 08 Feb 2007 07:14:36 GMT]]></title><description><![CDATA[<p>Ähhmmm... hInst kommt in Deinem Code-Schnippsel nicht vor.<br />
Und ja. Ich denke ohne einen #include &lt;windows.h&gt; wirst Du nicht weit kommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1224832</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1224832</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 08 Feb 2007 07:14:36 GMT</pubDate></item></channel></rss>