<?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[lokalen hook]]></title><description><![CDATA[<p>erstmal hoffe ich das das hier das richtige Forum ist. Sonst einfach verschieben.<br />
Nun zu meinem Problem. Ich will aus einer DLL heraus einen lokalen Hook erstellen. Die DLl ist im selben Prozess wie die andere Anwendung (Winamp -&gt; PluginDLL).<br />
Ich hab bis jetz folgendes:</p>
<pre><code class="language-cpp">hHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyHook, AfxGetInstanceHandle(), ???);
</code></pre>
<p>Jetzt fehlt mir nur noch die ThreadID für das Parentwindow (Hoffe ich <sup>_</sup>). Wie komme ich da ran?<br />
Danke für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/65021/lokalen-hook</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Apr 2026 13:24:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/65021.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Feb 2004 09:18:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to lokalen hook on Mon, 16 Feb 2004 09:18:38 GMT]]></title><description><![CDATA[<p>erstmal hoffe ich das das hier das richtige Forum ist. Sonst einfach verschieben.<br />
Nun zu meinem Problem. Ich will aus einer DLL heraus einen lokalen Hook erstellen. Die DLl ist im selben Prozess wie die andere Anwendung (Winamp -&gt; PluginDLL).<br />
Ich hab bis jetz folgendes:</p>
<pre><code class="language-cpp">hHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) KeyHook, AfxGetInstanceHandle(), ???);
</code></pre>
<p>Jetzt fehlt mir nur noch die ThreadID für das Parentwindow (Hoffe ich <sup>_</sup>). Wie komme ich da ran?<br />
Danke für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/460157</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/460157</guid><dc:creator><![CDATA[Daishy]]></dc:creator><pubDate>Mon, 16 Feb 2004 09:18:38 GMT</pubDate></item><item><title><![CDATA[Reply to lokalen hook on Mon, 16 Feb 2004 09:42:42 GMT]]></title><description><![CDATA[<p>GetCurrentThreadId?</p>
<p>AfxGetInstanceHandle ist aber keine WinAPI-Funktion, eher MFC. Suchst du nach einer MFC- oder einer WinAPI-Lösung?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/460181</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/460181</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Mon, 16 Feb 2004 09:42:42 GMT</pubDate></item><item><title><![CDATA[Reply to lokalen hook on Mon, 16 Feb 2004 09:50:01 GMT]]></title><description><![CDATA[<p>MFC...hät aber gedacht das SetWindowsHookEx WinApi is, deswegen.</p>
<p>Noch eine Frage: Muss die ganze Sache mit dem Funktionsexport (pragma etc) (wie bei globalen Hook) auch mit rein?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/460194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/460194</guid><dc:creator><![CDATA[Daishy]]></dc:creator><pubDate>Mon, 16 Feb 2004 09:50:01 GMT</pubDate></item><item><title><![CDATA[Reply to lokalen hook on Mon, 16 Feb 2004 12:20:37 GMT]]></title><description><![CDATA[<p>Soweit ich weiß braucht man kein #pragma um Funktionen zu exportieren. Ein _declspec(dllexport) reicht.</p>
<p>Die Hook-Funktion selber muss nicht exportiert werden, weder bei einem globalen noch bei einem lokalen Hook. Die Funktion zum Installieren der Hook schon, sonst kann sie ja nicht von außen aufgerufen werden.</p>
<p>Probier es doch einfach aus. <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/460329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/460329</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Mon, 16 Feb 2004 12:20:37 GMT</pubDate></item><item><title><![CDATA[Reply to lokalen hook on Mon, 16 Feb 2004 13:24:06 GMT]]></title><description><![CDATA[<p>OK, der Hook läuft jetzt. Jetzt brauche ich die Message.<br />
Die soll ja laut MSDN in einer CWPSTRUCT drinstecken und lparam ist ein Zeiger darauf.<br />
Habs bisher versucht so zu bekommen:</p>
<pre><code class="language-cpp">CWPSTRUCT *Msg = (CWPSTRUCT*) lparam;
</code></pre>
<p>das funktioniert aber nicht. <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/460382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/460382</guid><dc:creator><![CDATA[Daishy]]></dc:creator><pubDate>Mon, 16 Feb 2004 13:24:06 GMT</pubDate></item><item><title><![CDATA[Reply to lokalen hook on Mon, 16 Feb 2004 18:02:15 GMT]]></title><description><![CDATA[<p>Wie kommst du auf CWPSTRUCT? <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="😕"
    /></p>
<p>Wenn ich in der Platform SDK-Doku auf KeyboardProc gehe (die du mit WH_KEYBOARD installierst), finde ich nichts über CWPSTRUCT. CWPSTRUCT kommt nur bei einer WH_CALLWNDPROC Hook vor.</p>
<p>Aus der Doku zur KeyboardProc:</p>
<blockquote>
<p><strong>LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam);</strong></p>
<p><strong>code</strong><br />
[in] Specifies a code the hook procedure uses to determine how to process the message. If code is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned by CallNextHookEx. This parameter can be one of the following values.<br />
HC_ACTION<br />
The wParam and lParam parameters contain information about a keystroke message.<br />
HC_NOREMOVE<br />
The wParam and lParam parameters contain information about a keystroke message, and the keystroke message has not been removed from the message queue. (An application called the PeekMessage function, specifying the PM_NOREMOVE flag.)<br />
<strong>wParam</strong><br />
[in] Specifies the virtual-key code of the key that generated the keystroke message.<br />
<strong>lParam</strong><br />
[in] Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag. For more information about the lParam parameter, see Keystroke Message Flags. This parameter can be one or more of the following values.<br />
0-15<br />
Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user's holding down the key.<br />
16-23<br />
Specifies the scan code. The value depends on the OEM.<br />
24<br />
Specifies whether the key is an extended key, such as a function key or a key on the numeric keypad. The value is 1 if the key is an extended key; otherwise, it is 0.<br />
25-28<br />
Reserved.<br />
29<br />
Specifies the context code. The value is 1 if the ALT key is down; otherwise, it is 0.<br />
30<br />
Specifies the previous key state. The value is 1 if the key is down before the message is sent; it is 0 if the key is up.<br />
31<br />
Specifies the transition state. The value is 0 if the key is being pressed and 1 if it is being released.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/460597</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/460597</guid><dc:creator><![CDATA[Christoph]]></dc:creator><pubDate>Mon, 16 Feb 2004 18:02:15 GMT</pubDate></item></channel></rss>