<?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[Problem mit GetKeyEventResult aus Hook-Dll von CodeProject]]></title><description><![CDATA[<p>Hi!<br />
ich hab auch n Hook-Problem. Und zwar habe ich mir die Hook-Dll von <a href="http://www.codeproject.com/KB/system/KeyHook.aspx?display=PrintAll&amp;fid=46493&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;fr=26" rel="nofollow">CodeProject</a> heruntergeladen. Ich hab alle Funktionen eingebunden. Aber ich bekomme beim Aufruf der Funktion GetKeyEventResult immer einen Fehler:<br />
Zugriffsverletzung bei Adresse 00000000. Lesen von Adresse 00000000.<br />
Der Code sieht so aus:<br />
Cpp-Datei:</p>
<pre><code class="language-cpp">void __fastcall TForm1::KB_Hook(TMessage &amp;msg)
{
	KEYRESULT kr;
	UINT nMask = KH_MASK_KEYNAME;
	GetKeyEventResult(msg.WParam, msg.LParam, &amp;kr, nMask); //Hier gibts den Fehler
}
</code></pre>
<p>Header-Datei:</p>
<pre><code class="language-cpp">class TForm1 : public TForm
{
...
private:	// Benutzer-Deklarationen
	void __fastcall KB_Hook(TMessage &amp;msg);
	void __fastcall MS_Hook(TMessage &amp;msg);
...
public:		// Benutzer-Deklarationen
	BEGIN_MESSAGE_MAP
		MESSAGE_HANDLER(WM_KEYHOOK, TMessage, KB_Hook); //Dies ist für den Keyboardhook
		MESSAGE_HANDLER(WM_MOUSEHOOK, TMessage, MS_Hook); //Maus-hook is auch dabei ;)
	END_MESSAGE_MAP(TForm);
...
};
</code></pre>
<p>Vorher füge ich noch mit</p>
<pre><code class="language-cpp">KEYENTRY ke;
	ke.nMessage = WM_KEYHOOK; // Our message ID
	ke.hCallWnd = Handle; // Send message to this window
	ke.hHookWnd = 0; // Capture key-strokes occurred in any windows
	ke.iCombKeys = 0; // Combination key states do not matter
	ke.iIndicators = 0; // Caps-lock, Num-lock,
					   // Scroll-lock on/off states do not matter
	ke.iKeyEvent = KH_KEY_DOWN | KH_KEY_UP;
	ke.iMinVKCode = hotkey-&gt;HotKey; // Capture all keys regardless of their virtual key codes
	ke.iMaxVKCode = hotkey-&gt;HotKey;
	AddKeyEntry(&amp;ke);
</code></pre>
<p>die zu hookende Taste hinzu.<br />
hotkey ist einen THotKey-Komponente, in die nur einzelne Buchstaben eingegeben werden dürfen (kein Shift, etc..). Das soll aber auch noch geändert werden.</p>
<p>Kann mir jemand helfen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Sowohl bei dem Adress-Fehler als auch bei dem THotKey-Feld?</p>
<p>Edit: Der Hook wird auch nur aktiv, wenn das eigene Fenster im Focus ist. Kann mir da vllt jemand auch zu sagen, warum das nicht geht?</p>
<p>ich weis...drei Fragen auf einmal, und für jede Frage einen eigenen Thread, aber da die Fragen direkt zusammengehören, dachte ich mir, ich kanns auch in einen schreiben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/228012/problem-mit-getkeyeventresult-aus-hook-dll-von-codeproject</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 00:00:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/228012.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 22 Nov 2008 19:36:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit GetKeyEventResult aus Hook-Dll von CodeProject on Sat, 22 Nov 2008 19:40:42 GMT]]></title><description><![CDATA[<p>Hi!<br />
ich hab auch n Hook-Problem. Und zwar habe ich mir die Hook-Dll von <a href="http://www.codeproject.com/KB/system/KeyHook.aspx?display=PrintAll&amp;fid=46493&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;fr=26" rel="nofollow">CodeProject</a> heruntergeladen. Ich hab alle Funktionen eingebunden. Aber ich bekomme beim Aufruf der Funktion GetKeyEventResult immer einen Fehler:<br />
Zugriffsverletzung bei Adresse 00000000. Lesen von Adresse 00000000.<br />
Der Code sieht so aus:<br />
Cpp-Datei:</p>
<pre><code class="language-cpp">void __fastcall TForm1::KB_Hook(TMessage &amp;msg)
{
	KEYRESULT kr;
	UINT nMask = KH_MASK_KEYNAME;
	GetKeyEventResult(msg.WParam, msg.LParam, &amp;kr, nMask); //Hier gibts den Fehler
}
</code></pre>
<p>Header-Datei:</p>
<pre><code class="language-cpp">class TForm1 : public TForm
{
...
private:	// Benutzer-Deklarationen
	void __fastcall KB_Hook(TMessage &amp;msg);
	void __fastcall MS_Hook(TMessage &amp;msg);
...
public:		// Benutzer-Deklarationen
	BEGIN_MESSAGE_MAP
		MESSAGE_HANDLER(WM_KEYHOOK, TMessage, KB_Hook); //Dies ist für den Keyboardhook
		MESSAGE_HANDLER(WM_MOUSEHOOK, TMessage, MS_Hook); //Maus-hook is auch dabei ;)
	END_MESSAGE_MAP(TForm);
...
};
</code></pre>
<p>Vorher füge ich noch mit</p>
<pre><code class="language-cpp">KEYENTRY ke;
	ke.nMessage = WM_KEYHOOK; // Our message ID
	ke.hCallWnd = Handle; // Send message to this window
	ke.hHookWnd = 0; // Capture key-strokes occurred in any windows
	ke.iCombKeys = 0; // Combination key states do not matter
	ke.iIndicators = 0; // Caps-lock, Num-lock,
					   // Scroll-lock on/off states do not matter
	ke.iKeyEvent = KH_KEY_DOWN | KH_KEY_UP;
	ke.iMinVKCode = hotkey-&gt;HotKey; // Capture all keys regardless of their virtual key codes
	ke.iMaxVKCode = hotkey-&gt;HotKey;
	AddKeyEntry(&amp;ke);
</code></pre>
<p>die zu hookende Taste hinzu.<br />
hotkey ist einen THotKey-Komponente, in die nur einzelne Buchstaben eingegeben werden dürfen (kein Shift, etc..). Das soll aber auch noch geändert werden.</p>
<p>Kann mir jemand helfen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Sowohl bei dem Adress-Fehler als auch bei dem THotKey-Feld?</p>
<p>Edit: Der Hook wird auch nur aktiv, wenn das eigene Fenster im Focus ist. Kann mir da vllt jemand auch zu sagen, warum das nicht geht?</p>
<p>ich weis...drei Fragen auf einmal, und für jede Frage einen eigenen Thread, aber da die Fragen direkt zusammengehören, dachte ich mir, ich kanns auch in einen schreiben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619036</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619036</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Sat, 22 Nov 2008 19:40:42 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit GetKeyEventResult aus Hook-Dll von CodeProject on Sun, 23 Nov 2008 15:53:27 GMT]]></title><description><![CDATA[<p>Hmm weis keiner ne Antwort??</p>
<p>Ich hab das ganze Projekt mal <a href="http://xbockyx.xb.funpic.de/bildschirmausschnitt_speichern.rar" rel="nofollow">hier hochgeladen</a>, da ich auf einmal auch einen Linker error bekomme, ich aber nicht weis, woher <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619447</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Sun, 23 Nov 2008 15:53:27 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit GetKeyEventResult aus Hook-Dll von CodeProject on Sun, 23 Nov 2008 20:16:18 GMT]]></title><description><![CDATA[<p>So, der Linkererror is weg. Die anderen Probleme hab ich noch nicht gelöst bekommen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Bitte helft mir <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619614</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619614</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Sun, 23 Nov 2008 20:16:18 GMT</pubDate></item></channel></rss>