View Single Post
 
Old 08-27-2017, 09:26 PM
tcsh tcsh is offline
Member
 
Join Date: Sep 2016
Posts: 30
Default

Quote:
Originally Posted by Jasser View Post
Hello, thanks for the suggestion.

Quote:
I've tried it and it's not working:

Error on madExcept - I've taken care of that by installing it from the net (since I was missing the components)

Now once I run and generate the DLL it automatically erases madExcept from the uses clause in the code

and gives the following error: [dcc32 Error] HookLib.dpr(78): E2010 Incompatible types: 'NativeUInt' and 'Integer'

on the following line: hKeyHook := SetWindowsHookEx(WH_KEYBOARD, KeyHookFunc, hInstance, 0);

No clue how to get this to work / modify the code to trap only the L and not all the keys as it's currently doing

Using Rad Studio Tokyo 10.2

Later edit: Managed to get it working, was missing an @ at KeyHookFunc. Further, by tracing the tutorial you linked I stumbled across this: http://www.delphipraxis.net/1031080-post3.html

Solved it. Solution was to add: If VirtualKey = VK_F4 then (and replace VK_F4) with the key I want (my case Ord('L') right after Count: = ToAscii (VirtualKey, KeyStroke, KeyState1, AryChar, 0);

In case anyone finds this topic later on.

Again, thanks for the help Jasser, always a pleasure!

Last edited by tcsh; 08-28-2017 at 03:43 PM.