<?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[tastatur- und maus-spion]]></title><description><![CDATA[<p>hi,</p>
<p>ich wollte ein programm schreiben, welches in einer datei speichert, wie oft die linke maustaste oder z.B. das &quot;A&quot; gedrückt wurde. dazu müsste mein programm also alle nachrichten und nicht nur seine eigenen erhalten. gibt es also einen befehl, der windows sagt, dass mein programm alle nachrichten erhalten will?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/85643/tastatur-und-maus-spion</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 02:36:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/85643.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 11 Sep 2004 11:56:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to tastatur- und maus-spion on Sat, 11 Sep 2004 11:56:09 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>ich wollte ein programm schreiben, welches in einer datei speichert, wie oft die linke maustaste oder z.B. das &quot;A&quot; gedrückt wurde. dazu müsste mein programm also alle nachrichten und nicht nur seine eigenen erhalten. gibt es also einen befehl, der windows sagt, dass mein programm alle nachrichten erhalten will?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/604507</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/604507</guid><dc:creator><![CDATA[Herr-Vorragend]]></dc:creator><pubDate>Sat, 11 Sep 2004 11:56:09 GMT</pubDate></item><item><title><![CDATA[Reply to tastatur- und maus-spion on Sat, 11 Sep 2004 12:29:14 GMT]]></title><description><![CDATA[<p>Dafür müsstest du wohl mit SetWindowsHookEx einen Keyboard- bzw. Mouse-Hook einrichten. Code-Beispiel dazu gibt es auch in den FAQ <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/604534</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/604534</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sat, 11 Sep 2004 12:29:14 GMT</pubDate></item><item><title><![CDATA[Reply to tastatur- und maus-spion on Sat, 11 Sep 2004 13:39:07 GMT]]></title><description><![CDATA[<p>oh, okay, danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/604585</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/604585</guid><dc:creator><![CDATA[Herr-Vorragend]]></dc:creator><pubDate>Sat, 11 Sep 2004 13:39:07 GMT</pubDate></item><item><title><![CDATA[Reply to tastatur- und maus-spion on Sat, 11 Sep 2004 15:00:02 GMT]]></title><description><![CDATA[<p>ich hab jetzt folgendes script gebastelt:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK HookProc(int, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	static TCHAR szAppName[] = &quot;Bla&quot;;
	HWND		hWnd;
	MSG			msg;
	WNDCLASS	wndclass;

	wndclass.style			= CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc	= WndProc;
	wndclass.cbClsExtra		= 0;
	wndclass.cbWndExtra		= 0;
	wndclass.hInstance		= hInstance;
	wndclass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);
	wndclass.hCursor		= LoadCursor(NULL, IDC_ARROW);
	wndclass.hbrBackground	= (HBRUSH) GetStockObject(WHITE_BRUSH);
	wndclass.lpszMenuName	= NULL;
	wndclass.lpszClassName	= szAppName;

	RegisterClass(&amp;wndclass);

	hWnd = CreateWindow(	szAppName,
							&quot;Bla&quot;,
							WS_OVERLAPPEDWINDOW,
							CW_USEDEFAULT,
							CW_USEDEFAULT,
							CW_USEDEFAULT,
							CW_USEDEFAULT,
							NULL,
							NULL,
							hInstance,
							NULL);

	ShowWindow(hWnd, iCmdShow);
	UpdateWindow(hWnd);

	while (GetMessage(&amp;msg, NULL, 0, 0))
	{
		TranslateMessage(&amp;msg);
		DispatchMessage(&amp;msg);
	}
	return msg.wParam;
}

HHOOK	hhk;

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	FILE	*fp;

	switch (message)
	{
	case WM_CREATE:
		hhk = SetWindowsHookEx(WH_KEYBOARD, HookProc, ((LPCREATESTRUCT)lParam)-&gt;hInstance, 0L);
		return 0;

	case WM_DESTROY:
		fp = fopen(&quot;log.txt&quot;, &quot;a&quot;);
		fputc('\n', fp);
		fclose(fp);

		UnhookWindowsHookEx(hhk);
		PostQuitMessage(0);
		return 0;
	}

	return DefWindowProc(hWnd, message, wParam, lParam);
}

LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	FILE	*fp;

	if (nCode == HC_ACTION)
	{
		if ((lParam &amp; 1073741824) != 1073741824)
		{
			fp = fopen(&quot;log.txt&quot;, &quot;a&quot;);
			fputc((char)wParam, fp);
			fclose(fp);
		}
	} 
	return CallNextHookEx (hhk, nCode, wParam, lParam) ; 
}
</code></pre>
<p>aber wieso funktioniert es nur, wenn man im fenster des programms eine taste drückt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/604642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/604642</guid><dc:creator><![CDATA[Herr-Vorragend]]></dc:creator><pubDate>Sat, 11 Sep 2004 15:00:02 GMT</pubDate></item><item><title><![CDATA[Reply to tastatur- und maus-spion on Sat, 11 Sep 2004 15:01:28 GMT]]></title><description><![CDATA[<p>Wenn du einen systemweiten Hook brauchst, muss das in einer DLL sein...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/604644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/604644</guid><dc:creator><![CDATA[DLLL...]]></dc:creator><pubDate>Sat, 11 Sep 2004 15:01:28 GMT</pubDate></item><item><title><![CDATA[Reply to tastatur- und maus-spion on Sat, 11 Sep 2004 15:05:32 GMT]]></title><description><![CDATA[<p>achso, mal sehen ob ich das hinbekomme...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/604649</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/604649</guid><dc:creator><![CDATA[Herr-Vorragend]]></dc:creator><pubDate>Sat, 11 Sep 2004 15:05:32 GMT</pubDate></item></channel></rss>