SetCursorPos(PosX, PosY);SendMessage(WindowHandle, WM_RBUTTONDBLCLK, MK_RBUTTON, (LPARAM)MAKEWORD(PosX, PosY));
I haven''t tested this, but that''s my best guess
Crispy;
SetCursorPos(PosX, PosY);SendMessage(WindowHandle, WM_RBUTTONDBLCLK, MK_RBUTTON, (LPARAM)MAKEWORD(PosX, PosY));
int Width = 512, //Set the window width and height Height = 512; int DistanceToControl = 10000; //the distance in pixels to the desired control. //I made this number up. So, it might not be right :) int Centerx = Width\2, //Setting it to the center Centery = Height\2; SetCursorPos(Centerx, Centery); //Guess. Sleep(500);/*Lets pause so we can give the user a chance to realize he has no control*/ /*In the loop below i am assuming the control to be in a direct 45 degree diagonal with the center of the screen. If it isn't, you will need to change the angle by adjusting the change in x and y.*/ for (int i = 0; i < DistanceToControl, i++) { Centerx-=1; Centery-=1; SetCursorPos(Centerx, Centery); Sleep(250);/*Going to sleep so the cursor doesn't fly to the control. Sleep(...) Takes Milliseconds, so we are pausing for 1/4 of a second between each iteration of the loop. Not the best way, but its easy :)*/ } SendMessage(hWnd,WM_LBUTTONDOWN,0,0); /*I'm not sure i am using this corectly, so you might want to check some docs about it. But essentialy the logic is that we send your program a click event, and if i am thinking correctly, it should do everything else that it was supposed to.*/