delphi - Why does the Alt key not trigger my low-level keyboard hook? -


i experimenting keyboard hooks, , seems if alt key (amongst other command keys) not being hooked, , can't figure out why?

below keyboard hook debug code in prints out vkcode, scancode , lpchar readings.

it works keys basically, not alt , ctrl etc

function lowlevelkeybdhookproc(ncode, wparam, lparam : integer) : integer; stdcall; // possible wparam values: wm_keydown, wm_keyup, wm_syskeydown, wm_syskeyup var info : ^keybdllhookstruct absolute lparam;     lpchar : word;     kstate : tkeyboardstate;  begin result := callnexthookex(khook, ncode, wparam, lparam); info^   case wparam of     wm_keydown : begin       getkeyboardstate(kstate);        form1.memo1.text:=form1.memo1.text+'vkcode: '+inttostr(vkcode)+              ' scancode: '+inttostr(scancode)+              ' lpchar: '+inttostr(lpchar)+;     end;   end; end; 

to detect alt key going down, need respond wm_syskeydown.

note ignoring value of ncode. must read documentation , says.

a code hook procedure uses determine how process message. if ncode less zero, hook procedure must pass message callnexthookex function without further processing , should return value returned callnexthookex.

this parameter can 1 of following values.

hc_action (0). wparam , lparam parameters contain information keyboard message.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -