Re: Key Logger Component



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


.



Relevant Pages

  • Re: DART nearly a bullseye
    ... >> capability/requirements of a delivery vehicle to the Space Station. ... > tethering you have a set of capture conditions to catch the tether. ... At the Rbar or close to it, the Hook attachers, then ...
    (sci.space.shuttle)
  • Re: Point me in the right direction - Mouse utility...
    ... The only way I know of to capture mouse clicks that way is to use global ... make a C++ DLL, but make sure that it support global hooks. ... While a hook ... > exit the app, etc. ...
    (microsoft.public.vb.general.discussion)
  • Re: Capturing Mouse events outside Modal dialog box
    ... SetCapture seems to work only when the mouse is first Held Down in the ... Why would you want to capture WM_LBUTTONUP outside your dialog box if its ... not there from some kind of drag operation? ... You can use a mouse hook, or better yet a journal hook. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Key Logger Component
    ... > key logger type component, that can capture every keystroke, including ... > Ctrl-Alt-B. ... Also needs to capture function keys. ... Every keystroke will be made available to you, ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Capturing Mouse events outside Modal dialog box
    ... SetCapture seems to work only when the mouse is first Held Down in the ... Why would you want to capture WM_LBUTTONUP outside your dialog box if its ... You can use a mouse hook, or better yet a journal hook. ... If you use a mouse hook, you are going to be injecting your DLL into every ...
    (microsoft.public.win32.programmer.ui)