咦, 我在win32 hlp 中查看 WM_MOUSEMOVE, <br><br>WM_MOUSEMOVE <br>fwKeys = wParam; // key flags <br>xPos = LOWORD(lParam); // horizontal position of cursor <br>yPos = HIWORD(lParam); // vertical position of cursor <br><br>Parameters<br><br>fwKeys<br><br>Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: <br><br>Value Description<br>MK_CONTROL Set if the CTRL key is down.<br>MK_LBUTTON Set if the left mouse button is down.<br>MK_MBUTTON Set if the middle mouse button is down.<br>MK_RBUTTON Set if the right mouse button is down.<br>MK_SHIFT Set if the SHIFT key is down.<br><br>并且, 我也在Delphi中取出了各个键的状态. <br>鼓捣这玩意, 没经验的说, 希望能多学习学习. <br><br>例子如下, <br><br> TForm1 = class(TForm)<br> Edit1: TEdit;<br> Button1: TButton;<br> procedure FormCreate(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> YourHook: HHOOK;<br>function YourHookProc(Code: Integer; WParam: Longint; var Msg: TMsg): Longint; stdcall;<br><br>implementation<br><br>{$R *.DFM}<br>function YourHookProc(Code: Integer; WParam: Longint; var Msg: TMsg): Longint; stdcall;<br>begin<br> if Msg.Message = WM_MOUSEMOVE then begin<br> form1.Edit1.text := inttostr(msg.wParam); //msg.wParam 就是鼠标键和Shift/ctrl的各个状态值.<br> end;<br> Result := CallNextHookEx(YourHook, Code, WParam, Longint(@Msg));<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> YourHook := SetWindowsHookEx(WH_GETMESSAGE, @YourHookProc, 0, GetCurrentThreadID);<br>end;<br><br>