I just want to make a program get current cursor position then store it in array then play reverse of event with a loop and SetCursPos function i tried some codes but still could not do it here is code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
POINT p;
int arr[2];
GetCursorPos(&p);
arr[0] = p.x;
arr[1] = p.y;
int numPositions = sizeof(arr) / sizeof(p);
for (int i = numPositions - 1; i >= 0; i--) {
SetCursorPos(arr.[i].x, arr[i].y);
Sleep(100);
}
}
and i tried another one too :
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
POINT p;
int arr[2] = {0};
GetCursorPos(&p);
arr[0] = p.x;
arr[1] = p.y;
int numPositions = sizeof(arr) / sizeof(int);
for (size_t i = numPositions; i > 0; i--)
{
if (arr[i-1].x >= 0 && arr[i-1].x && (arr[i-1].y >= 0 && arr[i-1].y))
{
SetCursorPos(arr[i-1].x, arr[i-1].y);
Sleep(100);
}
}
}
im confused how to do what i planned in my mind maybe there is better ways for create what i want pls help!
Top comments (0)