不需要钩子就能做到。如果只是监控在本应用程序中鼠标是否按下,用Mouse.Capture是可以判断的;就看你是怎么用的?时机....如果需要全局监控,可以使用API:GetAsyncKeyState。以上两种方法,不论是哪种方式。触发时机要选好,目标:程序要能及时捕捉到鼠标动作。比如你可以用timer测试,时间间隔设置为1ms。API的使用,还是给你点代码,避免等下又说不行:procedure XXXXTimer(Sender: TObject); begin if GetAsyncKeyState(Vk_Lbutton) <> 0 then showmessage('鼠标左键按下'); end;
if GetAsyncKeyState(Vk_Lbutton) <> 0 then showmessage('鼠标左键按下');
if GetAsyncKeyState(Vk_Lbutton) <> 0 then showmessage('鼠标左键按下'); 搞定了,哈哈 谢谢
鼠标的钩子如何定义和处理呀?能给几行编码吗?
键盘勾子我会,鼠标勾子不知道如何做的.........
begin
if GetAsyncKeyState(Vk_Lbutton) <> 0 then
showmessage('鼠标左键按下');
end;
showmessage('鼠标左键按下');
showmessage('鼠标左键按下');
搞定了,哈哈 谢谢