I was looking a little about this particular problem that I have, I want to be able to simulate left-clicking on the program to which I am attached.
At the moment I am creating a thread that checks the database for specific values, and when these values ββare returned (the ones I am looking for), I want to be able to then send a left click in any x, y coordination of the program (while minimizing).
How to do it for Windows 7? Thanks!
EDIT: That's what I call a thread ...
HWND child = GetActiveWindow(); if ( child == NULL ) MessageBox(0,"Couldn't get the child hwnd!","",0); DWORD ID; HANDLE thread_check_game = CreateThread ( NULL , 0 , (LPTHREAD_START_ROUTINE) game_check_thread , (LPVOID)child, 0 , &ID ); CloseHandle ( game_check_thread );
and then...
DWORD WINAPI game_check_thread(LPVOID lpParam) { HWND Window; Window = (HWND)lpParam; // ... some other code ... // ... WORD mouseX = 398; WORD mouseY = 398; SendMessage(Window,WM_LBUTTONDOWN,MK_LBUTTON,MAKELPARAM(mouseX,mouseY)); SendMessage(Window, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(mouseX, mouseY)); Write("Sent Left Click\n"); ExitThread(0); return 0; }
source share