Dll文件中:
function MouseHook(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;export;
 begin
if wParam = 65 then
begin
data.Write('yes',3);
end;
{
if nCode = HCBT_SETFOCUS  then
begin
// MessageBeep(0);
 data.Write('yes',3);
end;       }
Result := CallNextHookEx(hook, nCode, wParam, lParam);
// Result := 0;
end;  {建立钩子}
function SetHook: Boolean; stdcall;
begin
data := TFileStream.Create('c:\test.txt',fmCreate or fmOpenWrite);
 // hook := SetWindowsHookEx(WH_KEYBOARD, @MouseHook, HInstance, 0);
hook := SetWindowsHookEx(WH_KEYBOARD, @MouseHook, GetModuleHandle('MyHook.DLL'), 0);
Result := hook <> 0;
 end;
为什么实现不了全局hook,只能在调用dll的程序中惯用,别的都不识别