<?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[C++ DLL und VB.NET 2008]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich hab ein ziemlich spezielles Problem. Da ich einige Speicher-Informationen auslesen möchte und dies aber mit <a href="http://VB.NET" rel="nofollow">VB.NET</a> nicht so problemlos möglich ist, habe ich versucht, mein funktionierendes C++-Konsolenprogramm in eine DLL umzuwandeln.</p>
<p>Auf diese wollte ich dann mit <a href="http://VB.NET" rel="nofollow">VB.NET</a> zugreifen, aber irgendwie will das nicht funktiuonieren.</p>
<p>Vielleicht könnt ihr euch mal den Code anschauen und mir sagen, wo der Fehler liegt?</p>
<p>MemoryDLL.cpp</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;

//#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;stdlib.h&gt;

HWND hwnd;
HANDLE handle;
DWORD ID;

extern &quot;C&quot; __declspec(dllexport)void GetName(DWORD PLAYERBASE_PTR, DWORD PLAYERBASE_OFFSET, char&amp; CharName);

void GetName(DWORD PLAYERBASE_PTR, DWORD PLAYERBASE_OFFSET, char&amp; CharName)
{
	using namespace std;

	hwnd = FindWindow(NULL, (LPCWSTR)&quot;Minesweeper&quot;);

    // Prozess-ID besorgen
	GetWindowThreadProcessId(hwnd, &amp;ID);

	// Prozess öffnen mit allen Rechten
	//handle = OpenProcess(PROCESS_ALL_ACCESS, false, ID);
	handle = OpenProcess(PROCESS_VM_READ, false, ID);
	// Struct erstellen
	char cname[17];
	DWORD baseptr;
	DWORD pptr;

	// Adresse auslesen
	ReadProcessMemory(handle, (void*)PLAYERBASE_PTR, &amp;baseptr, sizeof(baseptr), NULL);

	// Player Addy auslesen
	ReadProcessMemory(handle, (void*)(baseptr+PLAYERBASE_OFFSET), &amp;pptr, sizeof(pptr), NULL);

	// Name auslesen
	ReadProcessMemory(handle, (void*)(pptr+0x0278), &amp;cname, sizeof(cname), NULL);
}
</code></pre>
<p>dllmain.cpp</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
</code></pre>
<p>Der Wert, welcher in <strong>cname</strong> steht, soll dann in VB:NET weiter verarbeitet werden.</p>
<p>Dazu habe ich filgendes Programm probiert, aber es geht eben nicht.</p>
<pre><code>Imports System.Runtime.InteropServices

Public Class Form1

    Declare Auto Function GetName Lib &quot;D:\Dokumente und Einstellungen\Enrico.SkyNet\Desktop\bot\DLL\MemoryDLL\Release\MemoryDLL.dll&quot; ( _
        ByVal PLAYERBBASE_PTR As String, _
        ByVal PLAYERBASE_OFFSET As String, _
        ByRef CharName As String) _
        As String

    Dim PB_PTR As String = &quot;0x0088EF20&quot;
    Dim PB_OFFSET As String = &quot;0x0580&quot;
    Dim CN As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label1.Text = &quot;Start&quot;

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        GetName(PB_PTR, PB_OFFSET, CN)
        Label1.Text = PB_PTR
        Label2.Text = PB_OFFSET
        Label3.Text = CN
    End Sub
End Class
</code></pre>
<p>Irgendwie bekomme ich bei <strong>CN</strong> keinen Wert zurück.</p>
<p>MfG<br />
Memphis</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/243205/c-dll-und-vb-net-2008</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 01:53:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/243205.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 Jun 2009 07:28:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ DLL und VB.NET 2008 on Sun, 14 Jun 2009 07:28:19 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich hab ein ziemlich spezielles Problem. Da ich einige Speicher-Informationen auslesen möchte und dies aber mit <a href="http://VB.NET" rel="nofollow">VB.NET</a> nicht so problemlos möglich ist, habe ich versucht, mein funktionierendes C++-Konsolenprogramm in eine DLL umzuwandeln.</p>
<p>Auf diese wollte ich dann mit <a href="http://VB.NET" rel="nofollow">VB.NET</a> zugreifen, aber irgendwie will das nicht funktiuonieren.</p>
<p>Vielleicht könnt ihr euch mal den Code anschauen und mir sagen, wo der Fehler liegt?</p>
<p>MemoryDLL.cpp</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;

//#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;stdlib.h&gt;

HWND hwnd;
HANDLE handle;
DWORD ID;

extern &quot;C&quot; __declspec(dllexport)void GetName(DWORD PLAYERBASE_PTR, DWORD PLAYERBASE_OFFSET, char&amp; CharName);

void GetName(DWORD PLAYERBASE_PTR, DWORD PLAYERBASE_OFFSET, char&amp; CharName)
{
	using namespace std;

	hwnd = FindWindow(NULL, (LPCWSTR)&quot;Minesweeper&quot;);

    // Prozess-ID besorgen
	GetWindowThreadProcessId(hwnd, &amp;ID);

	// Prozess öffnen mit allen Rechten
	//handle = OpenProcess(PROCESS_ALL_ACCESS, false, ID);
	handle = OpenProcess(PROCESS_VM_READ, false, ID);
	// Struct erstellen
	char cname[17];
	DWORD baseptr;
	DWORD pptr;

	// Adresse auslesen
	ReadProcessMemory(handle, (void*)PLAYERBASE_PTR, &amp;baseptr, sizeof(baseptr), NULL);

	// Player Addy auslesen
	ReadProcessMemory(handle, (void*)(baseptr+PLAYERBASE_OFFSET), &amp;pptr, sizeof(pptr), NULL);

	// Name auslesen
	ReadProcessMemory(handle, (void*)(pptr+0x0278), &amp;cname, sizeof(cname), NULL);
}
</code></pre>
<p>dllmain.cpp</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
</code></pre>
<p>Der Wert, welcher in <strong>cname</strong> steht, soll dann in VB:NET weiter verarbeitet werden.</p>
<p>Dazu habe ich filgendes Programm probiert, aber es geht eben nicht.</p>
<pre><code>Imports System.Runtime.InteropServices

Public Class Form1

    Declare Auto Function GetName Lib &quot;D:\Dokumente und Einstellungen\Enrico.SkyNet\Desktop\bot\DLL\MemoryDLL\Release\MemoryDLL.dll&quot; ( _
        ByVal PLAYERBBASE_PTR As String, _
        ByVal PLAYERBASE_OFFSET As String, _
        ByRef CharName As String) _
        As String

    Dim PB_PTR As String = &quot;0x0088EF20&quot;
    Dim PB_OFFSET As String = &quot;0x0580&quot;
    Dim CN As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label1.Text = &quot;Start&quot;

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        GetName(PB_PTR, PB_OFFSET, CN)
        Label1.Text = PB_PTR
        Label2.Text = PB_OFFSET
        Label3.Text = CN
    End Sub
End Class
</code></pre>
<p>Irgendwie bekomme ich bei <strong>CN</strong> keinen Wert zurück.</p>
<p>MfG<br />
Memphis</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1726225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1726225</guid><dc:creator><![CDATA[Memphis1978]]></dc:creator><pubDate>Sun, 14 Jun 2009 07:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to C++ DLL und VB.NET 2008 on Wed, 17 Jun 2009 16:55:14 GMT]]></title><description><![CDATA[<p>Hat hier niemand eine Antwort für mich?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1728360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1728360</guid><dc:creator><![CDATA[Memphis1978]]></dc:creator><pubDate>Wed, 17 Jun 2009 16:55:14 GMT</pubDate></item><item><title><![CDATA[Reply to C++ DLL und VB.NET 2008 on Wed, 17 Jun 2009 18:37:51 GMT]]></title><description><![CDATA[<p>Da bist du im völlig falschen Forum. C++/CLI wäre passender. Oder vielleicht C# und .Net als Anlaufpunkt für alle allgemeinen .Net-Fragen.<br />
Hier geht es um Standard-C++, was was anderes ist als du willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1728431</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1728431</guid><dc:creator><![CDATA[mad_martin]]></dc:creator><pubDate>Wed, 17 Jun 2009 18:37:51 GMT</pubDate></item></channel></rss>