THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/05/2012 at 20:22, xxxxxxxx wrote:
Alrighty, I can virtually execute the mouse in any way I want - moving around, clicking buttons etc, however the viewport doesn't seem to respond to the actions properly.
I'm simply trying to execute a selection drag in the viewport, but at specific coordinates. The coordinates I can get, the selection drag I can't.
int X = 500; // for testing purposes
int Y = 250; // for testing purposes
int begin = SetCursorPos(X,Y);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, NULL);
int end = SetCursorPos(X+500,Y+250);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, NULL);
Please note: mouse_event is now deprecated but it's easier to get working than SendInput for the time being. Also, the coordinates are made to fit my screen but you may need to adjust them for yours if you test it out.
Is there something going on in the viewport that might be preventing such actions? Or maybe the rectangle tool itself can't be actioned virtually? Any thoughts?