HOOK 超级问题

HOOK 超级问题 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiAPI/html/delphi_20061111145304252.html
求一个最简单的键盘HOOK例子;  
    谢谢各位大爷了!

http://community.csdn.net/Expert/topic/5066/5066823.xml?temp=.5840876

太多例程了,我提供一个老外的:  
  http://www.delphifaq.com/faq/delphi_windows_API/f512.shtml

unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,   StdCtrls;  
   
  type  
      TForm1   =   class(TForm)  
          Memo1:   TMemo;  
          procedure   FormCreate(Sender:   TObject);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
      function   KeyBoardProc(code:integer;wparam:wparam;lparam:lparam):lresult;  
   
  var  
      Form1:   TForm1;  
      Hook:HHOOK;  
  implementation  
   
  {$R   *.dfm}  
   
  function   KeyBoardProc(code:integer;wparam:wparam;lparam:lparam):lresult;  
  begin  
      result:=0;       //0:表示截获后不处理键盘消息       1:表示截获后屏蔽键盘消息  
  end;  
   
  procedure   TForm1.FormCreate(Sender:   TObject);  
  begin  
      Hook:=SetWindowsHookEx(WH_KEYBOARD,@KeyBoardProc,hInstance,0);  
  end;

posted on 2009-04-08 09:16  delphi2007  阅读(276)  评论(0编辑  收藏  举报