Jump to content
SlicK

Inversarea directiei de mers a mouseului

Recommended Posts

Posted

Un mic programel :)


#include <windows.h>

int main()
{
POINT NewPoint,OldPoint; // coordonatele mouseului
RECT rc;
GetWindowRect(GetDesktopWindow(),&rc); // limitele ecranului
GetCursorPos(&OldPoint); // coordonata mouseului la pornirea prog
while(1)
{
Sleep(10);
GetCursorPos(&NewPoint); // coordonata curenta
// daca noua pozitie se incadreaza in limitele ecranului o setam
if(OldPoint.x*2-NewPoint.x>rc.left && OldPoint.x*2-NewPoint.x<rc.right) NewPoint.x=OldPoint.x*2-NewPoint.x;
if(OldPoint.y*2-NewPoint.y>rc.top && OldPoint.y*2-NewPoint.x<rc.bottom) NewPoint.y=OldPoint.y*2-NewPoint.y;
SetCursorPos(NewPoint.x,NewPoint.y); // mutam mouseul in noua pozitie
OldPoint=NewPoint;
}
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...