<?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[Keyboardhook]]></title><description><![CDATA[<p>Hallo,<br />
ich möchte bestimmte Tastatureingaben umleiten (Ich weiss, dass es auch andere Möglichkeiten als einen Hook gibt, aber ich brauche einen Hook auch aus anderen Gründen)<br />
Beispiel: Wenn die 'm' Taste gedrückt wird, soll Windows denken, die 'r' Taste wurde gedrückt.</p>
<p>Mein erster Versuch funktioniert, aber ich denke, man kann das innerhalb der KeyboardProc auch besser lösen...</p>
<pre><code class="language-cpp">// VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
#define VK_M 0x4D
#define VK_R 0x52

...

LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	if (nCode == HC_ACTION)
	{
		LPKBDLLHOOKSTRUCT p = reinterpret_cast&lt;LPKBDLLHOOKSTRUCT&gt;(lParam);

		if (!(p-&gt;flags &amp; LLKHF_UP) &amp;&amp; p-&gt;vkCode == VK_M)
		{
			keybd_event(VK_R, p-&gt;scanCode, p-&gt;flags, p-&gt;dwExtraInfo);

			return 1;
		}
	}

	return CallNextHookEx(NULL, nCode, wParam, lParam);
}
</code></pre>
<p>MfG,<br />
Max</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/230834/keyboardhook</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 20:24:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/230834.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Jan 2009 16:58:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Keyboardhook on Fri, 02 Jan 2009 16:58:02 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich möchte bestimmte Tastatureingaben umleiten (Ich weiss, dass es auch andere Möglichkeiten als einen Hook gibt, aber ich brauche einen Hook auch aus anderen Gründen)<br />
Beispiel: Wenn die 'm' Taste gedrückt wird, soll Windows denken, die 'r' Taste wurde gedrückt.</p>
<p>Mein erster Versuch funktioniert, aber ich denke, man kann das innerhalb der KeyboardProc auch besser lösen...</p>
<pre><code class="language-cpp">// VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
#define VK_M 0x4D
#define VK_R 0x52

...

LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	if (nCode == HC_ACTION)
	{
		LPKBDLLHOOKSTRUCT p = reinterpret_cast&lt;LPKBDLLHOOKSTRUCT&gt;(lParam);

		if (!(p-&gt;flags &amp; LLKHF_UP) &amp;&amp; p-&gt;vkCode == VK_M)
		{
			keybd_event(VK_R, p-&gt;scanCode, p-&gt;flags, p-&gt;dwExtraInfo);

			return 1;
		}
	}

	return CallNextHookEx(NULL, nCode, wParam, lParam);
}
</code></pre>
<p>MfG,<br />
Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638455</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638455</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Fri, 02 Jan 2009 16:58:02 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Fri, 02 Jan 2009 17:31:03 GMT]]></title><description><![CDATA[<p>Das Einzige, was mir hier einfällt, ist, dass keybd_event als obsolet deklariert ist und man SendInput verwenden soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638472</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638472</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Fri, 02 Jan 2009 17:31:03 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Fri, 02 Jan 2009 18:21:54 GMT]]></title><description><![CDATA[<p>Hast Du einfach mal versucht die Daten in der Struktur zu verändern. Was sagt dei Doku dazu?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638495</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638495</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 02 Jan 2009 18:21:54 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Fri, 02 Jan 2009 18:59:00 GMT]]></title><description><![CDATA[<p>Ja, habe ich schon: Die alte Taste kommt an, es funktioniert also nicht.<br />
In der Doku steht: wParam und lParam sind nur [in]<br />
Aber sie müssten ja [inout] sein, damit das gehen würde...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638506</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Fri, 02 Jan 2009 18:59:00 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Fri, 02 Jan 2009 21:15:05 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Hast Du einfach mal versucht die Daten in der Struktur zu verändern. Was sagt dei Doku dazu?</p>
</blockquote>
<p>Nein, das geht nicht.</p>
<p>Du kannst es entweder so machen wie bisher, oder einen Nachrichten Hook verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638558</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638558</guid><dc:creator><![CDATA[Master Jay]]></dc:creator><pubDate>Fri, 02 Jan 2009 21:15:05 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Fri, 02 Jan 2009 22:53:28 GMT]]></title><description><![CDATA[<p>Oha, davon habe ich noch gar nichts gehört! Was ist denn ein Nachrichtenhook?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638598</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Fri, 02 Jan 2009 22:53:28 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Sat, 03 Jan 2009 12:14:03 GMT]]></title><description><![CDATA[<p>siehe MSDN</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638731</guid><dc:creator><![CDATA[Master Jay]]></dc:creator><pubDate>Sat, 03 Jan 2009 12:14:03 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Sat, 03 Jan 2009 13:27:43 GMT]]></title><description><![CDATA[<p>Habe ich gleich gemacht. Aber ich werde nicht schlau daraus.<br />
Zuerst einmal: Meinst du <a href="http://msdn.microsoft.com/en-us/library/ms644959.aspx#whgetmessagehook" rel="nofollow">WH_GETMESSAGE Hooks</a> oder <a href="http://msdn.microsoft.com/en-us/library/ms644959.aspx#wh_msgfilter_wh_sysmsgfilterhooks" rel="nofollow">WH_MSGFILTER and WH_SYSMSGFILTER Hooks</a>?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638780</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638780</guid><dc:creator><![CDATA[ripmav]]></dc:creator><pubDate>Sat, 03 Jan 2009 13:27:43 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Sat, 03 Jan 2009 13:38:59 GMT]]></title><description><![CDATA[<p>WH_GETMESSAGE</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638789</guid><dc:creator><![CDATA[Master Jay]]></dc:creator><pubDate>Sat, 03 Jan 2009 13:38:59 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook on Sat, 03 Jan 2009 13:44:03 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-146610-and-highlight-is-whgetmessage.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-146610-and-highlight-is-whgetmessage.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638792</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638792</guid><dc:creator><![CDATA[Master Jay]]></dc:creator><pubDate>Sat, 03 Jan 2009 13:44:03 GMT</pubDate></item></channel></rss>