I already know how to send mouse co-ordinates and click with the mouse (using SendInput()), however it does not work.
I would also like to know how to send text (several words, though, not single keys) to other programs.
As a side note, if anyone knows how to take words from an image (like text-recognition), I'd like to know that too.
Thanks.
I have this code to move and click the mouse:
Code:
int x, y;
double fScreenWidth = ::GetSystemMetrics(SM_CXSCREEN)-1;
double fScreenHeight = ::GetSystemMetrics(SM_CYSCREEN)-1;
double fx = x*(65535.0f/fScreenWidth);
double fy = y*(65535.0f/fScreenHeight);
INPUT Input = {0};
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_MOVE|MOUSEEVENTF_ABSOLUTE; // Move to the co-ordinates
Input.mi.dx = fx;
Input.mi.dy = fy;
::SendInput(1,&Input,sizeof(INPUT)); // Send the input
::ZeroMemory(&Input,sizeof(INPUT)); // Clear the memory used
Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
::SendInput(1,&Input,sizeof(INPUT)); // Send the input
::ZeroMemory(&Input,sizeof(INPUT)); // Clear the memory used
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
::SendInput(1,&Input,sizeof(INPUT)); // Send the input
::ZeroMemory(&Input,sizeof(INPUT)); // Clear the memory used
and although I have included windows.h; my compiler claims that INPUT and INPUT_MOUSE have not been declared. This is quite confusing...
Edit: My compiler is Dev-C++ 4.9.9.2