<?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-Hook mit BCB 1 und FAQ-Hilfe]]></title><description><![CDATA[<p>Hi!</p>
<p>ich hab das mit dem Tastatur-Hook aus der <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39145.html" rel="nofollow">FAQ</a> mit meinem Borland c++ Builder 1 Standard versucht, jedoch gibt es dabei einige Fehler:</p>
<p>project1.cpp:</p>
<pre><code class="language-cpp">extern &quot;C&quot; __declspec(dllexport) __stdcall void SetHook(void);//Declaration terminated incorrectly
extern &quot;C&quot; __declspec(dllexport) __stdcall void RemoveHook(void);//Declaration terminated incorrectly
extern &quot;C&quot; __declspec(dllexport) __stdcall DWORD CheckKey(int, WORD,LONG);//Multiple declaration for 'DWORD' //Type mismatch in redeclaration //Declaration Syntax error
</code></pre>
<p>windef.h</p>
<pre><code class="language-cpp">typedef unsigned long       DWORD; //Earlier declaration for 'DWORD'
</code></pre>
<p>Ich hab die DLL so erzeugt: -&gt;Datei -&gt;Neu...<br />
und dann DLL ausgewählt.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194487/tastatur-hook-mit-bcb-1-und-faq-hilfe</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 06:28:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194487.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 07 Oct 2007 16:50:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Sun, 07 Oct 2007 16:50:25 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>ich hab das mit dem Tastatur-Hook aus der <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39145.html" rel="nofollow">FAQ</a> mit meinem Borland c++ Builder 1 Standard versucht, jedoch gibt es dabei einige Fehler:</p>
<p>project1.cpp:</p>
<pre><code class="language-cpp">extern &quot;C&quot; __declspec(dllexport) __stdcall void SetHook(void);//Declaration terminated incorrectly
extern &quot;C&quot; __declspec(dllexport) __stdcall void RemoveHook(void);//Declaration terminated incorrectly
extern &quot;C&quot; __declspec(dllexport) __stdcall DWORD CheckKey(int, WORD,LONG);//Multiple declaration for 'DWORD' //Type mismatch in redeclaration //Declaration Syntax error
</code></pre>
<p>windef.h</p>
<pre><code class="language-cpp">typedef unsigned long       DWORD; //Earlier declaration for 'DWORD'
</code></pre>
<p>Ich hab die DLL so erzeugt: -&gt;Datei -&gt;Neu...<br />
und dann DLL ausgewählt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379854</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Sun, 07 Oct 2007 16:50:25 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Sun, 07 Oct 2007 23:26:01 GMT]]></title><description><![CDATA[<p>Der Code aus der FAQ ist ok; habe fix mal eine App aufgesetzt.</p>
<p>Beim Projekt-Erstellen gab es keine Fehler und die Tastenanschläge (in Notepad)<br />
werden in der Listbox ausgegeben.</p>
<p>Sicher hast du beim Strg+C was vergessen...</p>
<p>Ob es an der betagten BCB-Version 1 liegen könnte ?</p>
<p>MfG<br />
kpeter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1380170</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1380170</guid><dc:creator><![CDATA[kpeter]]></dc:creator><pubDate>Sun, 07 Oct 2007 23:26:01 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Tue, 09 Oct 2007 14:35:49 GMT]]></title><description><![CDATA[<p>vllt liegts an dem BCB 1. Kann mir jemand vllt helfen, dies mit BCB 1 zu realisieren?</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381380</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Tue, 09 Oct 2007 14:35:49 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Tue, 09 Oct 2007 17:14:13 GMT]]></title><description><![CDATA[<p>Darf man fragen warum, da doch zwei Nachfolger kostenlos erhältlich sind?</p>
<p>In der Hook-Demoanwendung befindet sich übrigens ein Fehler:</p>
<pre><code class="language-cpp">HHOOK ghhookKB; // hier

...

void __stdcall SetHook(void)
{
  HOOKPROC lpfnHookProc = NULL;
  lpfnHookProc = GetProcAddress(GetModuleHandle(&quot;keydll.dll&quot;),&quot;CheckKey&quot;);
  ghhookKB = SetWindowsHookEx(WH_KEYBOARD, lpfnHookProc, ghInst, NULL);
}

...

DWORD __stdcall CheckKey(int nCode, WORD wParam, LONG lParam)
{
  HWND ghAppWnd = FindWindow(&quot;TKeyHookForm&quot;, 0);
  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>
<p>Die globale Variable ghhookKB existiert für jede DLL-Instanz separat; sie wird zwar in der vom ausführenden Programm explizit geladenen Instanz von SetHook() gesetzt, doch als Folge auf das Erstellen des Hooks wird die DLL von Windows in alle laufenden Prozesse injiziert, und in diesen Instanzen ist ghhookKB undefiniert. Die Konsequenz ist, daß der Aufruf von CallNextHookEx() in CheckKey() scheitert, wodurch der Tastendruck nicht an zuvor installierte Hooks weitergeleitet wird.</p>
<p>Die korrekte Lösung des Problems wäre, mittels CreateFileMapping() und MapViewOfFile() die Variable instanzübergreifend verfügbar zu machen.</p>
<p>Das dürfte zwar nicht der Grund für das Versagen mit dem BCC 5.1 sein, doch vielleicht berücksichtigst du es in der weiteren Verwendung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381497</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381497</guid><dc:creator><![CDATA[audacia]]></dc:creator><pubDate>Tue, 09 Oct 2007 17:14:13 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Tue, 09 Oct 2007 19:05:04 GMT]]></title><description><![CDATA[<p>Ich versteh deine Frage nicht.</p>
<p>Ich benutze BCB 1.0 und nicht BCC 5.1.</p>
<p>zum eigentlichen problem:Kann man nicht einfach jemand die dll kompilieren, sodass ich sie dann in meinem Prog aufrufen kann?? Wobei dann würde es sinnvoll sein, dass an die Funktione SetHook() ein Parameter mit der Taste angegeben wird.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381569</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Tue, 09 Oct 2007 19:05:04 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Tue, 09 Oct 2007 19:11:36 GMT]]></title><description><![CDATA[<p>Ausgerechnet eine TastaturHook-DLL willst du von einem Fremden erstellen lassen!? Warum bittest du deine Anwender nicht gleich, Ihre Passwörter, PIN+TAN usw. auf einen grossen Zettel zu schreiben und aus dem Fenster zu hängen!?</p>
<p>Was die kostenlosen Alternativen zu deinem Museumsstück betrifft, da bezog sich audacia sicher auf Sachen wie <a href="http://www.turboexplorer.com/" rel="nofollow">http://www.turboexplorer.com/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381571</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Tue, 09 Oct 2007 19:11:36 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Tue, 09 Oct 2007 19:32:09 GMT]]></title><description><![CDATA[<blockquote>
<p>Bocky&lt; schrieb:<br />
Ich benutze BCB 1.0 und nicht BCC 5.1.</p>
</blockquote>
<p>BCB = Borland C++Builder<br />
BCC = Borland C++ Compiler</p>
<p>Der BCB 1.0 verwendet den BCC 5.1.</p>
<p>Mit den Alternativen meinte ich den C++Builder 6 Personal und Turbo C++ Explorer, die kostenlose Edition von C++Builder 2006, auf das Jansen verwiesen hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381579</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381579</guid><dc:creator><![CDATA[audacia]]></dc:creator><pubDate>Tue, 09 Oct 2007 19:32:09 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Wed, 10 Oct 2007 06:37:53 GMT]]></title><description><![CDATA[<p>Möchte diesen Thread nicht unnötig &quot;auswalzen&quot;, und dem Autor dieses Themas wäre<br />
damit auch nicht geholfen, aber :</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/8276">@audacia</a></p>
<p>audacia schrieb:</p>
<blockquote>
<p>In der Hook-Demoanwendung befindet sich übrigens ein Fehler:...</p>
</blockquote>
<p>Fehler hin, Fehler her.<br />
So wie der Code in der FAQ steht, ist er zunächst mal syntaktisch korrekt.<br />
(Sonst würde er <strong>so</strong> nicht in der FAQ stehen.;) )</p>
<p>Eventuell kommt man so ohne DLL aus:</p>
<pre><code class="language-cpp">.
.
.
hHook = SetWindowsHookEx( WH_KEYBOARD, (HOOKPROC)HookProcedure, NULL, 
                                  GetWindowThreadProcessId( hWnd, NULL));
.
.
</code></pre>
<p>MfG<br />
kpeter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381716</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381716</guid><dc:creator><![CDATA[kpeter]]></dc:creator><pubDate>Wed, 10 Oct 2007 06:37:53 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Wed, 10 Oct 2007 10:15:14 GMT]]></title><description><![CDATA[<p>kpeter schrieb:</p>
<blockquote>
<p>Fehler hin, Fehler her.<br />
So wie der Code in der FAQ steht, ist er zunächst mal syntaktisch korrekt.<br />
(Sonst würde er <strong>so</strong> nicht in der FAQ stehen.;) )</p>
</blockquote>
<p>Ich darf dich hier mal mit einem süffisanten Lächeln auf meine Signatur verweisen.</p>
<p>kpeter schrieb:</p>
<blockquote>
<p>Eventuell kommt man so ohne DLL aus:</p>
<pre><code class="language-cpp">.
.
.
hHook = SetWindowsHookEx( WH_KEYBOARD, (HOOKPROC)HookProcedure, NULL, 
                                  GetWindowThreadProcessId( hWnd, NULL));
.
.
</code></pre>
</blockquote>
<p>Dann ist der Hook auf den Prozeß, der in installiert, beschränkt; sobald eine andere Anwendung aktiv wird, ist er nicht mehr wirksam.<br />
Steht übrigens alles in der WinAPI-Dokumentation.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381896</guid><dc:creator><![CDATA[audacia]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:15:14 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Wed, 10 Oct 2007 10:45:53 GMT]]></title><description><![CDATA[<p>Klaro,</p>
<p>Zitat aus der API:<br />
&quot;If the application installs a hook procedure for a thread of a different application, the procedure must be in a DLL.&quot;</p>
<p>Wer zeichnet auch schon die Tastenanschläge im eigenen Programm auf...</p>
<p>MfG<br />
kpeter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1381922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1381922</guid><dc:creator><![CDATA[kpeter]]></dc:creator><pubDate>Wed, 10 Oct 2007 10:45:53 GMT</pubDate></item><item><title><![CDATA[Reply to Tastatur-Hook mit BCB 1 und FAQ-Hilfe on Wed, 10 Oct 2007 13:17:02 GMT]]></title><description><![CDATA[<p>Ich find zwar links zu Compiler runterladen, aber da gibts nur fehlermeldungen. <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/1382083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1382083</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Wed, 10 Oct 2007 13:17:02 GMT</pubDate></item></channel></rss>