🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3885

Re: Disable keyboard only

#3885
From: Tom
Date: Tue, 11 Apr 2006 06:43
48 lines
2255 bytes
My Form code:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    FARPROC   HookProc;
    HINSTANCE DLL;
    HHOOK   Hook;
    DLL      = LoadLibrary("DLL.dll");
    HookProc = GetProcAddress(DLL, "KeyboardHookProc");
    Hook     = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)HookProc, DLL, NULL);
}
//---------------------------------------------------------------

MY Dll code:

#include <windows.h>

LRESULT CALLBACK KeyboardHookProc(int code, WPARAM wParam, LPARAM lParam)
{
 return CallNextHookEx(NULL, code, wParam, lParam);
 }
//---------------------------------------------------------------


Is this SetWindowsHookEx() ok, should I simply remove return 0 instead of
CallNextHookEx(NULL, code, wParam, lParam) from dll?

Thanks in advance,
Tom.

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:443acbd9$1@newsgroups.borland.com...
>
> "Tom" <tom@net.com> wrote in message
> news:443ab295$1@newsgroups.borland.com...
>
> > I need to disable keyboard (including ctr+alt+del, ctrl+shift+esc,...),
> > but I need to leave the mouse enabled. Is there anything similar to
> > BlockInput(True), but for keyboard only.
>
> You will have to install a global keyboard hook via the SetWindowsHookEx()
> function in a DLL, and have your callback function discard all key
strokes.
>
>
> Gambit
>
>
Technical Details
Message-ID: <443b501d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <443ab295$1@newsgroups.borland.com> <443acbd9$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f3e4bc5a377be414
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Tom" <tom@net.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <443ab295$1@newsgroups.borland.com> <443acbd9$1@newsgroups.borland.com>
Subject: Re: Disable keyboard only
Date: Tue, 11 Apr 2006 08:43:40 +0200
Lines: 50
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
NNTP-Posting-Host: 213.202.126.18
Message-ID: <443b501d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1144737821 213.202.126.18 (10 Apr 2006 23:43:41 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail