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.
You might be looking for
ClipCursorFunction. 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.