<?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[KeyHook anpassen]]></title><description><![CDATA[<p>Also ich hab zurzeit den KeyHook aus der FAQ allerdings, hab zwar das überspringen bei gleicher taste schon entfernt gekriegt und läuft auch recht gut ( auch wenn das was man tun musste damits läuft nicht ganz der anleitung entsprach )...</p>
<p>nur ist das problem ich will es für ein spiel nutzen, und jetzt will ich das es auf einer tastertur geht und z.B. w und s für den linken spieler sind ( hoch, runter ) und i und k für den rechten, nur wenn ich bei diesem keyhook jetzt 2 tasten gleichzeitig dann wird eine davon immer blockiert... gibts da ne möglichkeit das anzupassen das ich da wirklich mit 2 tasten &quot;gleichzeitig&quot; umgehen kann?<br />
Sozusagen das er immer zwischen den beiden tasten hin und her swapt.</p>
<p>hier nochmal die keyhook source.</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#include &lt;windows.h&gt;
#pragma hdrstop
//---------------------------------------------------------------------------

#define WM_KEYHOOK WM_USER+100
HHOOK ghhookKB;
HINSTANCE ghInst;
#pragma argsused
//---------------------------------------------------------------------------

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
  ghInst = hinst;
  return (1);
}
//---------------------------------------------------------------------------

extern &quot;C&quot; __declspec(dllexport) __stdcall void SetHook(void);
extern &quot;C&quot; __declspec(dllexport) __stdcall void RemoveHook(void);
extern &quot;C&quot; __declspec(dllexport) __stdcall DWORD CheckKey(int, WORD,LONG);
//---------------------------------------------------------------------------

void __stdcall SetHook(void)
{
  HOOKPROC lpfnHookProc = NULL;// Dll sollte so heißen wie das Projekt ( BCB 6 )
  lpfnHookProc = GetProcAddress(GetModuleHandle(&quot;Project1.dll&quot;),&quot;CheckKey&quot;);
  ghhookKB = SetWindowsHookEx(WH_KEYBOARD, lpfnHookProc, ghInst, NULL);
}
//---------------------------------------------------------------------------

void __stdcall RemoveHook(void)
{
  UnhookWindowsHookEx(ghhookKB);
}
//---------------------------------------------------------------------------

DWORD __stdcall CheckKey(int nCode, WORD wParam, LONG lParam)
{
  HWND ghAppWnd = FindWindow(&quot;TForm1&quot;, 0);// Name der Form an die Gesendet wird
  if((nCode &lt; 0) || nCode == HC_NOREMOVE)
    return CallNextHookEx(ghhookKB, nCode, wParam, lParam);

  // Skip if it's a repeat
  //if(lParam &amp; 0x40000000)
  //  return CallNextHookEx(ghhookKB, nCode, wParam, lParam);

  // Send key information to the main window
  SendMessage(ghAppWnd, WM_KEYHOOK, 0, lParam);

  return CallNextHookEx(ghhookKB, nCode, wParam, lParam);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/206390/keyhook-anpassen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 03:40:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/206390.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 24 Feb 2008 16:49:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to KeyHook anpassen on Sun, 24 Feb 2008 17:00:25 GMT]]></title><description><![CDATA[<p>Also ich hab zurzeit den KeyHook aus der FAQ allerdings, hab zwar das überspringen bei gleicher taste schon entfernt gekriegt und läuft auch recht gut ( auch wenn das was man tun musste damits läuft nicht ganz der anleitung entsprach )...</p>
<p>nur ist das problem ich will es für ein spiel nutzen, und jetzt will ich das es auf einer tastertur geht und z.B. w und s für den linken spieler sind ( hoch, runter ) und i und k für den rechten, nur wenn ich bei diesem keyhook jetzt 2 tasten gleichzeitig dann wird eine davon immer blockiert... gibts da ne möglichkeit das anzupassen das ich da wirklich mit 2 tasten &quot;gleichzeitig&quot; umgehen kann?<br />
Sozusagen das er immer zwischen den beiden tasten hin und her swapt.</p>
<p>hier nochmal die keyhook source.</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#include &lt;windows.h&gt;
#pragma hdrstop
//---------------------------------------------------------------------------

#define WM_KEYHOOK WM_USER+100
HHOOK ghhookKB;
HINSTANCE ghInst;
#pragma argsused
//---------------------------------------------------------------------------

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
  ghInst = hinst;
  return (1);
}
//---------------------------------------------------------------------------

extern &quot;C&quot; __declspec(dllexport) __stdcall void SetHook(void);
extern &quot;C&quot; __declspec(dllexport) __stdcall void RemoveHook(void);
extern &quot;C&quot; __declspec(dllexport) __stdcall DWORD CheckKey(int, WORD,LONG);
//---------------------------------------------------------------------------

void __stdcall SetHook(void)
{
  HOOKPROC lpfnHookProc = NULL;// Dll sollte so heißen wie das Projekt ( BCB 6 )
  lpfnHookProc = GetProcAddress(GetModuleHandle(&quot;Project1.dll&quot;),&quot;CheckKey&quot;);
  ghhookKB = SetWindowsHookEx(WH_KEYBOARD, lpfnHookProc, ghInst, NULL);
}
//---------------------------------------------------------------------------

void __stdcall RemoveHook(void)
{
  UnhookWindowsHookEx(ghhookKB);
}
//---------------------------------------------------------------------------

DWORD __stdcall CheckKey(int nCode, WORD wParam, LONG lParam)
{
  HWND ghAppWnd = FindWindow(&quot;TForm1&quot;, 0);// Name der Form an die Gesendet wird
  if((nCode &lt; 0) || nCode == HC_NOREMOVE)
    return CallNextHookEx(ghhookKB, nCode, wParam, lParam);

  // Skip if it's a repeat
  //if(lParam &amp; 0x40000000)
  //  return CallNextHookEx(ghhookKB, nCode, wParam, lParam);

  // Send key information to the main window
  SendMessage(ghAppWnd, WM_KEYHOOK, 0, lParam);

  return CallNextHookEx(ghhookKB, nCode, wParam, lParam);
}
//---------------------------------------------------------------------------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1462037</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1462037</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Sun, 24 Feb 2008 17:00:25 GMT</pubDate></item><item><title><![CDATA[Reply to KeyHook anpassen on Sun, 24 Feb 2008 20:04:54 GMT]]></title><description><![CDATA[<p>Die Problematik dieses FAQ-Eintrages wurde ja schon andernorts ausführlich diskutiert. Mir stellt sich hier vor allem die Frage: warum zum Kuckuck benutzt du Hooks für gewöhnliche Tastaturabfragen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1462140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1462140</guid><dc:creator><![CDATA[audacia]]></dc:creator><pubDate>Sun, 24 Feb 2008 20:04:54 GMT</pubDate></item><item><title><![CDATA[Reply to KeyHook anpassen on Sun, 24 Feb 2008 23:37:43 GMT]]></title><description><![CDATA[<p>weil das ding sozusagen überm desktop läuft, und ich will ja das das auch geht wenn man z.B. gerade im firefox ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1462258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1462258</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Sun, 24 Feb 2008 23:37:43 GMT</pubDate></item><item><title><![CDATA[Reply to KeyHook anpassen on Mon, 25 Feb 2008 15:06:55 GMT]]></title><description><![CDATA[<p>Ist denn das was ich anstrebe überhaupt möglich?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1462547</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1462547</guid><dc:creator><![CDATA[Schurke]]></dc:creator><pubDate>Mon, 25 Feb 2008 15:06:55 GMT</pubDate></item><item><title><![CDATA[Reply to KeyHook anpassen on Tue, 04 Mar 2008 15:53:31 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Offenbar weiß hier keiner eine konkrete Antwort. Ich verschieb dich mal ins WinAPI-Forum.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468140</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 04 Mar 2008 15:53:31 GMT</pubDate></item><item><title><![CDATA[Reply to KeyHook anpassen on Tue, 04 Mar 2008 15:53:42 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-14774.html" rel="nofollow">akari</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-2.html" rel="nofollow">VCL (C++ Builder)</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-4.html" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1468141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1468141</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Tue, 04 Mar 2008 15:53:42 GMT</pubDate></item></channel></rss>