如何改变鼠标在钩子中的位置
我想知道如何在 MouseProc 函数中更改鼠标位置。特别是保持 Y 坐标相同。这是我的功能:
function HookProc(nCode: Integer; MsgID: WParam; Data: LParam): LResult; stdcall;
var
begin
PMouseHookStruct(Data)^.pt.Y:=600;
Result := CallNextHookEx(Hook,nCode,MsgID,Data);
end;
我认为重写 MouseHookStruct Y 坐标可以解决问题,但显然不行。
I would like to know how I can change mouse position in MouseProc function. Specifically to keep Y-coordinate the same. This is my function:
function HookProc(nCode: Integer; MsgID: WParam; Data: LParam): LResult; stdcall;
var
begin
PMouseHookStruct(Data)^.pt.Y:=600;
Result := CallNextHookEx(Hook,nCode,MsgID,Data);
end;
I thought that re-writing the MouseHookStruct Y-coord would do the trick, but apparently not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能正在寻找
ClipCursor
函数。无需使用钩子。评论:
游标是共享资源。如果应用程序限制了光标,则在将控制权交给另一个应用程序之前,它必须使用 ClipCursor 释放光标。
该函数将光标限制在屏幕上的矩形区域。
You might be looking for
ClipCursor
Function. No need to use hooks.Remark:
The cursor is a shared resource. If an application confines the cursor, it must release the cursor by using ClipCursor before relinquishing control to another application.
The function confines the cursor to a rectangular area on the screen.
查看
SetCursorPos
Win32 函数。Have a look at the
SetCursorPos
Win32 function.