Re: Key Logger Component
- From: Günter Kieninger <g.kieninger@xxxxxx>
- Date: Tue, 21 Jun 2005 09:56:12 +0200
In article <42b77aec@xxxxxxxxxxxxxxxxxxxxxx>, Paul Coshott wrote:
> we have a point of sale app that is completely keyboard driven (no mouse)
> and we have a strange bug that we cannot replicate. Does anyone know of a
> key logger type component, that can capture every keystroke, including Ctrl,
> Shift and Alt (and combinations of these) with a letter. eg Ctrl-Alt-B. Also
> needs to capture function keys.
>
> Anyone know of a component to do this ?
Not a component but source which workes well here (D5)
-------------------
in FormCreate of the MainForm
Hook := SetWindowsHookEx(WH_KEYBOARD, KeyboardHook, 0,
GetCurrentThreadId);
in FormDestroy
UnhookWindowsHookEx(Hook);
and Hook is defined as
Hook: HHOOK;
function KeyboardHook(code: Integer; wparam: WPARAM; lparam: LPARAM): LRESULT
stdcall;
function GetKeyName(lParam: Integer): String;
var
Buf: array[0..31] of Char;
begin
SetString(Result, Buf, GetKeyNameText(lParam, Buf, SizeOf(Buf)));
if windows.GetKeyState(VK_MENU) < 0 then { VK_MENU }
Result := 'Alt+' + Result;
if windows.GetKeyState(VK_CONTROL) < 0 then
Result := 'Ctrl+' + Result;
if windows.GetKeyState(VK_SHIFT) < 0 then
Result := 'Shift+' + Result;
end;
begin
if (Code >= 0) and (lParam >= 0) and not (wParam in [VK_SHIFT, VK_CONTROL,
VK_MENU])
then Mainwws.AddToLastAction(GetKeyName(lParam));
Result := CallNextHookEx(Hook, Code, wParam, lParam);
end;
-------------------
HTH
Gruß aus den Bergen
Günter
.
- References:
- Key Logger Component
- From: Paul Coshott
- Key Logger Component
- Prev by Date: Re: Periklis Remote control status?
- Next by Date: Re: Periklis Remote control status?
- Previous by thread: Key Logger Component
- Next by thread: Re: Key Logger Component
- Index(es):
Relevant Pages
|