uses
   SysUtils,Classes,Dialogs,windows;{$R *.res}var
  hookHandle:HHOOK;
  hookCode:string;  function KeyBoardHook(code:Integer;
                        wparaw:Cardinal;
                        lparaw:Cardinal):Cardinal;stdcall;
  begin
     if code >0 then
     begin
      // hookCode := hookCode + IntToStr(code);
       ShowMessage(IntToStr(code));
       CallNextHookEx(hookHandle,code,wparaw,lparaw);
     end;
  end;  function StartHook(SysType:Integer):Boolean;stdcall;
  begin
       hookHandle := SetWindowsHookEx(WH_KEYBOARD,@KeyBoardHook,HInstance,SysType);
       if hookHandle <> 0 then
       begin
         //ShowMessage('钩子安装成功!');
         Result := True;
       end
       else
       begin
         //ShowMessage('钩子安装失败!');
         Result := False;
       end;
  end;  function UnSetHook:Boolean;stdcall;
  begin
      Result := UnhookWindowsHookEx(hookHandle);
  end;  function GetPass:string;stdcall;
  begin
    Result := hookCode;
  end;  exports
      StartHook,GetPass,UnSetHook;  begin  end.
安装钩子的时候 总是失败! 请高手指点!