<?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[Tasten sperren (Finde Thread nicht mehr :( )]]></title><description><![CDATA[<p>Hallo,<br />
ich hatte einen Thread geöffnet den ich nicht mehr finde, weder per Suche mit &quot;Autor&quot;, mit &quot;*tasten* *sperren*&quot; oder &quot;*hhook*&quot;</p>
<p>Also ich möchte Tasten systemweit sperren.<br />
Mein Quelltest (aus dem Beispiel)</p>
<p>unit1.cpp</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TKeyHookForm *KeyHookForm;

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);
//---------------------------------------------------------------------------
__fastcall TKeyHookForm::TKeyHookForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TKeyHookForm::KeyHook(TMessage &amp;Message)
{
  char Key[80];
  GetKeyNameText(Message.LParam, Key, 80);
  NULL;
}
//---------------------------------------------------------------------------

void __fastcall TKeyHookForm::Button2Click(TObject *Sender)
{
RemoveHook();
Application-&gt;Terminate();
}
//---------------------------------------------------------------------------

void __fastcall TKeyHookForm::Button1Click(TObject *Sender)
{
SetHook();        
}
//---------------------------------------------------------------------------
</code></pre>
<p>keydll.dll</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;
  lpfnHookProc = GetProcAddress(GetModuleHandle(&quot;keydll.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;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);
}
//---------------------------------------------------------------------------

unit1.h
[cpp]
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
#define WM_KEYHOOK WM_USER+100 
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
//---------------------------------------------------------------------------
class TKeyHookForm : public TForm
{
__published:    // Von der IDE verwaltete Komponenten
        TButton *Button1;
        TButton *Button2;
        TLabel *Label1;
        TLabel *Label2;
        void __fastcall Label1Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall Button1Click(TObject *Sender);
private: // User declarations
  MESSAGE void __fastcall KeyHook(TMessage &amp;Message);
    BEGIN_MESSAGE_MAP
      MESSAGE_HANDLER(WM_KEYHOOK, TMessage, KeyHook);
    END_MESSAGE_MAP(TForm);
public:     // Anwender-Deklarationen 
        __fastcall TKeyHookForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TKeyHookForm *KeyHookForm;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/164546/tasten-sperren-finde-thread-nicht-mehr</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 11:29:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/164546.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Nov 2006 14:54:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Tasten sperren (Finde Thread nicht mehr :( ) on Thu, 09 Nov 2006 14:54:40 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich hatte einen Thread geöffnet den ich nicht mehr finde, weder per Suche mit &quot;Autor&quot;, mit &quot;*tasten* *sperren*&quot; oder &quot;*hhook*&quot;</p>
<p>Also ich möchte Tasten systemweit sperren.<br />
Mein Quelltest (aus dem Beispiel)</p>
<p>unit1.cpp</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------

#include &lt;vcl.h&gt;
#pragma hdrstop

#include &quot;Unit1.h&quot;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource &quot;*.dfm&quot;
TKeyHookForm *KeyHookForm;

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);
//---------------------------------------------------------------------------
__fastcall TKeyHookForm::TKeyHookForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TKeyHookForm::KeyHook(TMessage &amp;Message)
{
  char Key[80];
  GetKeyNameText(Message.LParam, Key, 80);
  NULL;
}
//---------------------------------------------------------------------------

void __fastcall TKeyHookForm::Button2Click(TObject *Sender)
{
RemoveHook();
Application-&gt;Terminate();
}
//---------------------------------------------------------------------------

void __fastcall TKeyHookForm::Button1Click(TObject *Sender)
{
SetHook();        
}
//---------------------------------------------------------------------------
</code></pre>
<p>keydll.dll</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;
  lpfnHookProc = GetProcAddress(GetModuleHandle(&quot;keydll.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;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);
}
//---------------------------------------------------------------------------

unit1.h
[cpp]
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
#define WM_KEYHOOK WM_USER+100 
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
//---------------------------------------------------------------------------
class TKeyHookForm : public TForm
{
__published:    // Von der IDE verwaltete Komponenten
        TButton *Button1;
        TButton *Button2;
        TLabel *Label1;
        TLabel *Label2;
        void __fastcall Label1Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall Button1Click(TObject *Sender);
private: // User declarations
  MESSAGE void __fastcall KeyHook(TMessage &amp;Message);
    BEGIN_MESSAGE_MAP
      MESSAGE_HANDLER(WM_KEYHOOK, TMessage, KeyHook);
    END_MESSAGE_MAP(TForm);
public:     // Anwender-Deklarationen 
        __fastcall TKeyHookForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TKeyHookForm *KeyHookForm;
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1171733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1171733</guid><dc:creator><![CDATA[damniiiiit]]></dc:creator><pubDate>Thu, 09 Nov 2006 14:54:40 GMT</pubDate></item><item><title><![CDATA[Reply to Tasten sperren (Finde Thread nicht mehr :( ) on Thu, 09 Nov 2006 14:55:30 GMT]]></title><description><![CDATA[<p>Sorry,</p>
<p>jedenfalls weiß ich nicht wie genau ich das jetzt machen soll, das die Tasten systemweit nicht mehr funktionieren.</p>
<p>Danke im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1171734</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1171734</guid><dc:creator><![CDATA[damniiiiit]]></dc:creator><pubDate>Thu, 09 Nov 2006 14:55:30 GMT</pubDate></item><item><title><![CDATA[Reply to Tasten sperren (Finde Thread nicht mehr :( ) on Sat, 11 Nov 2006 12:38:33 GMT]]></title><description><![CDATA[<p>Weiß keiner? ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1172431</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1172431</guid><dc:creator><![CDATA[damniiiiit]]></dc:creator><pubDate>Sat, 11 Nov 2006 12:38:33 GMT</pubDate></item><item><title><![CDATA[Reply to Tasten sperren (Finde Thread nicht mehr :( ) on Sun, 12 Nov 2006 09:58:52 GMT]]></title><description><![CDATA[<p>ich könnte mir durchaus vorstellen, das einige hier soetwas können, doch diese werden auf soetwas kaum antworten.</p>
<p>eventuell ist es mit hooks möglich, aber damit habe ich mich noch kaum beschäfftigt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1172878</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1172878</guid><dc:creator><![CDATA[vale]]></dc:creator><pubDate>Sun, 12 Nov 2006 09:58:52 GMT</pubDate></item><item><title><![CDATA[Reply to Tasten sperren (Finde Thread nicht mehr :( ) on Sun, 12 Nov 2006 11:51:50 GMT]]></title><description><![CDATA[<p>Naja ist doch ein KeyBoard Hook so nennt man es glaub ich.<br />
Aber ich glaub man muss nur was in TKeyHookForm::KeyHook schreiben damit das funktioniert.</p>
<p>Wieso sollten die die davon Ahnung haben nicht darauf antworten? Habe ich etwas faölsch gemacht? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1172927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1172927</guid><dc:creator><![CDATA[damniiiiit]]></dc:creator><pubDate>Sun, 12 Nov 2006 11:51:50 GMT</pubDate></item></channel></rss>