tags:

views:

74

answers:

1

Hi. I develop an application, which automates some simple tasks inside Virtual PC. Now I faced with problem: I can't figure out how I can manipulate mouse inside VPC. I do something like this:

HWND hDW = (HWND)0x000B03E0; // handle to virtual machine screen    

int x = 70;
int y = 130;

SendMessage(hDW, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(x, y));
SendMessage(hDW, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(x, y));

SendMessage(hDW, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(x, y));
SendMessage(hDW, WM_RBUTTONUP, MK_RBUTTON, MAKELPARAM(x, y));

But it doesn't work. Can anyone show me how perform this task?

+1  A: 

This might be what you are looking for.

I have used the mouse_input to do what you are looking for but it seems that is deprecated and you should use the SendInput instead.

mouse_input

SendInput

EDIT:

you could hide the cursor during the move like this (reference)

SetCrusor( GetCursor() );
ShowCursor(false);
// SendInput()  move mouse do stuff
ShowCursor(true);
corn3lius
Thanks corn3lius. SendInput works, but there is one problem with it: I need to move mouse cursor to position, where I want to perform click. How can I do it without actually moving mouse cursor?
see edits in post.
corn3lius