<?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 debuggen]]></title><description><![CDATA[<p>Hallo,<br />
ich schreibe eine DLL und möchte gerne wisse, was dadrinnen so vor sich geht.<br />
Ich suche nun nach einer Möglichkeit, möglichst einfach Daten nach aussen zu geben.<br />
Auf die Konsole schreiben habe ich schon probiert:</p>
<pre><code>#define MAKE_DLL

// INCLUDES //////////////////////////////////////////////////////////////
#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
//#undef MessageBox;
#include &lt;fstream&gt;

#include &quot;Hook.h&quot;

// DEFINES ///////////////////////////////////////////////////////////////

// CONSTANTS /////////////////////////////////////////////////////////////

// GLOBALS ///////////////////////////////////////////////////////////////

#pragma data_seg (&quot;shared&quot;)

// iNumInstances = 0;
HHOOK hMouseHook =0;
int iKeystrokes[255] = {0};
#pragma data_seg ()
#pragma comment(linker,&quot;/SECTION:shared,RWS&quot;)

// PROTOTYPES ////////////////////////////////////////////////////////////

LRESULT CALLBACK MouseHookProc(int, WPARAM, LPARAM);
void OutputKeystrokes();

// VARIABLES /////////////////////////////////////////////////////////////

HINSTANCE	hDllInstance;

// METHODS ///////////////////////////////////////////////////////////////

// FUNCTIONS /////////////////////////////////////////////////////////////

int APIENTRY DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
{
	hDllInstance = hInstance;

	return TRUE;
}

BOOL CALLBACK InstallHooks(void)
{
	//MessageBox::Show(&quot;Test&quot;, &quot;Überschrift&quot;, MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
	HANDLE hConsoleOutput;
	CHAR_INFO lpPuffer[2*2];
	COORD dwPufferSize;
	COORD dwPufferCoord;
	SMALL_RECT lpWriteRegion;

	//Init
	hConsoleOutput= &quot;GENERIC_WRITE&quot;;
	lpPuffer[0].Char.AsciiChar='x';
	lpPuffer[0].Attributes=BACKGROUND_BLUE | FOREGROUND_GREEN;
	lpPuffer[1]=lpPuffer[0];
	lpPuffer[2]=lpPuffer[0];
	lpPuffer[3]=lpPuffer[0];
	dwPufferSize.X=2;
	dwPufferSize.Y=2;

	dwPufferCoord.X=0;
	dwPufferCoord.Y=0;

	lpWriteRegion.Left=0;
	lpWriteRegion.Top=0;
	lpWriteRegion.Bottom=2;
	lpWriteRegion.Right=2;
	WriteConsoleOutput(hConsoleOutput, lpPuffer, dwPufferSize, dwPufferCoord, &amp;lpWriteRegion);

	if (hMouseHook  ==0) hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookProc, hDllInstance, NULL);

    if (hMouseHook == NULL)
    {
        return FALSE;
    }

    return TRUE;
}

BOOL CALLBACK UnInstallHooks(void)
{
    OutputKeystrokes();

    return UnhookWindowsHookEx(hMouseHook);
}

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam,LPARAM lParam)
{
	//std::ofstream out(&quot;c:\\mousehook.txt&quot;); //create file to write
	if(nCode &lt; 0) return CallNextHookEx(hMouseHook, nCode, wParam, lParam); //validate if this hook is allowed to work
	//else:start filtering...

    /*MOUSEHOOKSTRUCT * pMouseStruct = (MOUSEHOOKSTRUCT *)lParam;
	int x = pMouseStruct-&gt;pt.x;
    int y = pMouseStruct-&gt;pt.y;

	out &lt;&lt; x &lt;&lt; &quot;\n&quot;;
	out &lt;&lt; y &lt;&lt; &quot;\n&quot;;*/

	return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
}

void OutputKeystrokes()
{
    /*

    for (int i='A'; i&lt;='Z'; i++)
    {
        out &lt;&lt; (char)i &lt;&lt; &quot; = &quot; &lt;&lt; iKeystrokes[i] &lt;&lt; &quot;\n&quot;;
    }*/
}
</code></pre>
<p>Leider kann ich in meinem Command Window nichts sehen!<br />
Ist das die Konsole, oder verbirgt sich die woanders?<br />
Gibt es vielleicht auch eine einfachere Möglichkeit?<br />
Vielleicht mit einer MessageBox?<br />
Hab ich, wie man sehen kann, auch schon probiert, leider auch ohne Erfolg.</p>
<p>Würde mich über Hilfe sehr freuen!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/144010/dll-debuggen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 10:51:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/144010.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Apr 2006 17:00:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DLL debuggen on Thu, 13 Apr 2006 17:00:12 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich schreibe eine DLL und möchte gerne wisse, was dadrinnen so vor sich geht.<br />
Ich suche nun nach einer Möglichkeit, möglichst einfach Daten nach aussen zu geben.<br />
Auf die Konsole schreiben habe ich schon probiert:</p>
<pre><code>#define MAKE_DLL

// INCLUDES //////////////////////////////////////////////////////////////
#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
//#undef MessageBox;
#include &lt;fstream&gt;

#include &quot;Hook.h&quot;

// DEFINES ///////////////////////////////////////////////////////////////

// CONSTANTS /////////////////////////////////////////////////////////////

// GLOBALS ///////////////////////////////////////////////////////////////

#pragma data_seg (&quot;shared&quot;)

// iNumInstances = 0;
HHOOK hMouseHook =0;
int iKeystrokes[255] = {0};
#pragma data_seg ()
#pragma comment(linker,&quot;/SECTION:shared,RWS&quot;)

// PROTOTYPES ////////////////////////////////////////////////////////////

LRESULT CALLBACK MouseHookProc(int, WPARAM, LPARAM);
void OutputKeystrokes();

// VARIABLES /////////////////////////////////////////////////////////////

HINSTANCE	hDllInstance;

// METHODS ///////////////////////////////////////////////////////////////

// FUNCTIONS /////////////////////////////////////////////////////////////

int APIENTRY DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
{
	hDllInstance = hInstance;

	return TRUE;
}

BOOL CALLBACK InstallHooks(void)
{
	//MessageBox::Show(&quot;Test&quot;, &quot;Überschrift&quot;, MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
	HANDLE hConsoleOutput;
	CHAR_INFO lpPuffer[2*2];
	COORD dwPufferSize;
	COORD dwPufferCoord;
	SMALL_RECT lpWriteRegion;

	//Init
	hConsoleOutput= &quot;GENERIC_WRITE&quot;;
	lpPuffer[0].Char.AsciiChar='x';
	lpPuffer[0].Attributes=BACKGROUND_BLUE | FOREGROUND_GREEN;
	lpPuffer[1]=lpPuffer[0];
	lpPuffer[2]=lpPuffer[0];
	lpPuffer[3]=lpPuffer[0];
	dwPufferSize.X=2;
	dwPufferSize.Y=2;

	dwPufferCoord.X=0;
	dwPufferCoord.Y=0;

	lpWriteRegion.Left=0;
	lpWriteRegion.Top=0;
	lpWriteRegion.Bottom=2;
	lpWriteRegion.Right=2;
	WriteConsoleOutput(hConsoleOutput, lpPuffer, dwPufferSize, dwPufferCoord, &amp;lpWriteRegion);

	if (hMouseHook  ==0) hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookProc, hDllInstance, NULL);

    if (hMouseHook == NULL)
    {
        return FALSE;
    }

    return TRUE;
}

BOOL CALLBACK UnInstallHooks(void)
{
    OutputKeystrokes();

    return UnhookWindowsHookEx(hMouseHook);
}

LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam,LPARAM lParam)
{
	//std::ofstream out(&quot;c:\\mousehook.txt&quot;); //create file to write
	if(nCode &lt; 0) return CallNextHookEx(hMouseHook, nCode, wParam, lParam); //validate if this hook is allowed to work
	//else:start filtering...

    /*MOUSEHOOKSTRUCT * pMouseStruct = (MOUSEHOOKSTRUCT *)lParam;
	int x = pMouseStruct-&gt;pt.x;
    int y = pMouseStruct-&gt;pt.y;

	out &lt;&lt; x &lt;&lt; &quot;\n&quot;;
	out &lt;&lt; y &lt;&lt; &quot;\n&quot;;*/

	return CallNextHookEx(hMouseHook, nCode, wParam, lParam);
}

void OutputKeystrokes()
{
    /*

    for (int i='A'; i&lt;='Z'; i++)
    {
        out &lt;&lt; (char)i &lt;&lt; &quot; = &quot; &lt;&lt; iKeystrokes[i] &lt;&lt; &quot;\n&quot;;
    }*/
}
</code></pre>
<p>Leider kann ich in meinem Command Window nichts sehen!<br />
Ist das die Konsole, oder verbirgt sich die woanders?<br />
Gibt es vielleicht auch eine einfachere Möglichkeit?<br />
Vielleicht mit einer MessageBox?<br />
Hab ich, wie man sehen kann, auch schon probiert, leider auch ohne Erfolg.</p>
<p>Würde mich über Hilfe sehr freuen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1036987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1036987</guid><dc:creator><![CDATA[Originalhanno]]></dc:creator><pubDate>Thu, 13 Apr 2006 17:00:12 GMT</pubDate></item><item><title><![CDATA[Reply to DLL debuggen on Thu, 13 Apr 2006 17:35:17 GMT]]></title><description><![CDATA[<p>Debuggen !?<br />
OutputDebugString und DebugView!?<br />
<a href="http://www.sysinternals.com/Utilities/DebugView.html" rel="nofollow">http://www.sysinternals.com/Utilities/DebugView.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1037010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1037010</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Thu, 13 Apr 2006 17:35:17 GMT</pubDate></item><item><title><![CDATA[Reply to DLL debuggen on Thu, 13 Apr 2006 20:38:03 GMT]]></title><description><![CDATA[<p>Danke, kannte ich nicht.<br />
Wie benutzt man das?<br />
Gibt es eine Anleitung?<br />
Was muss ich in den Quelltext schreiben?<br />
Ich kann auf der HP nichts finden...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1037161</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1037161</guid><dc:creator><![CDATA[Originalhanno]]></dc:creator><pubDate>Thu, 13 Apr 2006 20:38:03 GMT</pubDate></item></channel></rss>