实现键盘操作鼠标<--出现了个小问题,求助!
//DLL代码如下:library MouseHOOK;
uses
Windows, Messages;
var
hNextHookProc: HHook;
//↓核心代码段↓
function KeyboardHookHandler(iCode: Integer;wParam: WPARAM;lParam: LPARAM): LRESULT; stdcall; export;
const
_KeyPressMask = $80000000;
var
p:TPoint;
begin
If iCode < 0 Then
begin
Result := CallNextHookEx(hNextHookProc, iCode, wParam, lParam);
Exit;
end;
if ((lParam and _KeyPressMask) <> 0) and (wParam =120)then
begin
Mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); <----问题在这,希望能实现按下F9的时候,控制鼠标左键按下,在桌面操作没发现问题,当打开一个文件夹,然后点关闭按钮的时候,卡在按下的操作里面,无法关闭文件夹---->
<----求大神给点意见,怎么解决这个实现键盘操作鼠标---->
end;
if ((lParam and _KeyPressMask) = 0) and ////F9键值
(wParam =120)then
begin
Mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);//模拟鼠标按下左键后松开
end;
if ((lParam and _KeyPressMask) <> 0) and (wParam =121)then
begin
Mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
end;
if ((lParam and _KeyPressMask) = 0) and (wParam =121)then
begin
Mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);//模拟鼠标按下右键
end;
end;
function DisableMouse: BOOL; export;
begin
Result := False;
if hNextHookProc <> 0 then Exit;
hNextHookProc := SetWindowsHookEx(WH_MOUSE,MouseHookProc,HInstance,0);
Result:=False;
end;
function EnableMouse: BOOL; export;
begin
if hNextHookProc <> 0 then
begin
UnhookWindowshookEx(hNextHookProc);
hNextHookProc := 0;
end;
Result := hNextHookProc = 0;
end;
exports
EnableMouse,
DisableMouse;
end.
无法关闭文件夹 网络学习 发表于 2013-5-23 00:01 static/image/common/back.gif
无法关闭文件夹
您说的没错,我就是想知道该如何关闭,好像很难? 真是难得给力的帖子啊。 网友 发表于 2013-5-23 14:45 static/image/common/back.gif
真是难得给力的帖子啊。
{:2_38:}0.0..... wangjie371324 发表于 2013-5-23 20:17 static/image/common/back.gif
0.0.....
灌水哥 巴黎欧莱雅你值得拥有
页:
[1]