🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #477

Re: How can I change/remap keys from inside my keyboard hook? (I've been searching all day...)

#477
From: Ante Smolcic
Date: Thu, 13 Jan 2005 09:39
46 lines
3020 bytes
In article <1105557699.667151.276930@z14g2000cwz.googlegroups.com>, 
jklimek@gmail.com says...
> I've written a global keyboard hook (which works perfectly fine) but
> I'm trying to remap keys as they are entered...
> 
> For example, if somebody types the letter 'G', I want to change that
> 'G' into a 'K' (etc, etc)...
> 
> I've been searching all day long and I've read about using keybd_event
> and I've tried the following code, but I enter an infinite loop of some
> sort.  Please help...

Hi, I haven't had much experience with hooks. My first and only project 
had problems with freezing the system after a while. Few years later I 
discovered the problem was in Delphi's handling of dll functions that 
use the FPU. Anyway, I didn't use keyboard hook but a global message 
hook and just changed the key value in the message record.

I never had the chance to look into it further. Anyway, I had this link 
http://www.gajits.com/p_delphihooks.html

but it doesn't work anymore, fortunately, I have it dowloaded on my 
disk, so if you want it, send me a mail to:

supersmola - inet - hr (replace dashes with @ and .)



As far as the infinite loop, it obviously has something to do with this 
statement, right:

if ((fromKeybdEvt and $FF00) = $C100) then

Aparently it returns false. You may try logging the fromKeybdEvt value 
and see what it is.

Another hint - I think I saw a KeyboardHoook demo in the JCL od JCL-VCL 
package.


And what is HookInformation? It's not declared anywhare.



-- 
Volume six, ha, ha, ha.
Technical Details
Message-ID: <MPG.1c506035fff458ef98a2c6@news.iskon.hr>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!Iskon!not-for-mail
References: <1105557699.667151.276930@z14g2000cwz.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10baee,797761edfabd18bb
X-Google-Thread: 111659,797761edfabd18bb
X-Google-Thread: 10261c,797761edfabd18bb
X-Google-Thread: 1091e5,797761edfabd18bb
X-Google-Thread: 113dfb,797761edfabd18bb
X-Google-Attributes: gid10baee,gid111659,gid10261c,gid1091e5,gid113dfb,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!Iskon!not-for-mail
From: Ante Smolcic <spam@supersmola.net>
Newsgroups: comp.lang.pascal.delphi.misc,comp.lang.pascal.borland,comp.lang.pascal.misc,borland.public.delphi.winapi,comp.os.ms-windows.programmer.win32
Subject: Re: How can I change/remap keys from inside my keyboard hook?  (I've been searching all day...)
Date: Thu, 13 Jan 2005 10:39:21 +0100
Organization: Nevenkin bazen
Lines: 46
Message-ID: <MPG.1c506035fff458ef98a2c6@news.iskon.hr>
References: <1105557699.667151.276930@z14g2000cwz.googlegroups.com>
NNTP-Posting-Host: 213.191.151.54
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: 7bit
X-Trace: sunce.iskon.hr 1105609244 4676 213.191.151.54 (13 Jan 2005 09:40:44 GMT)
X-Complaints-To: abuse@iskon.hr
NNTP-Posting-Date: 13 Jan 2005 09:40:44 GMT
User-Agent: MicroPlanet-Gravity/2.70.2067
X-Face: v|By=kg`U$xz-'o4Wb@;n8J6z`+d<5v?*qe/xLT$\w7<w)oMFn72):iK7WFnJ}inP`A3M{k(<dItWED4S0VzpM-UM_ZLQ>]USN=bs+$ss`D3jXU@DwTwYqwG(0T/urD#~~,WX1'dZ?TJ5`~_5P@/Pj'(4!"FAtNaJ@&x"7&-tDS3A|.2w|Qh5Ad+