Immer wenn eine Tastatureingabe über einem fremden Fenster erfolgt ist das Handle( von der hookenden Anwendung) was ich vorher übergeben habe 0 und meine selbstdefinierte Nachricht kommt net an. Hier mal der Code
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
| var
hhook, callingwin: Cardinal;
const WM_HOOKMSG = WM_USER+6652;
function KBHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; var
KeyboardLayout: HKL; LastKey : Char; KeyState : TKeyboardState; Key : Word;
begin Result := CallNextHookEx(hhook, nCode, wParam, lParam); if ( nCode<=0 )then exit; KeyboardLayout:=GetKeyboardLayout(0); GetKeyboardState(KeyState); if ToAsciiEx(wParam,MapVirtualKeyEx(wParam,2,KeyboardLayout),KeyState,@LastKey,0,KeyboardLayout)>0 then Key:=Ord(wParam) else Key:=wParam; MessageBox(0, LPCTSTR(IntToStr(CallingWin)), 'Hndle', 0); end; |
//Edit: Ich bin dumm. das is ja nur nen lokaler hook. @mods: könnt das topic löschen