sendinput
i used double fScreenWidth = ::GetSystemMetrics( SM_CXSCREEN )-1;
double fScreenHeight = ::GetSystemMetrics( SM_CYSCREEN )-1;
double fx = pt.x*(65535.0f/fScreenWidth);
double fy = pt.y*(65535.0f/fScreenHeight);
INPUT Input={0};
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_MOVE|MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_LEFTDOWN;
Input.mi.dx = fx;
Input.mi.dy = fy;
::SendInput(1,&Input,sizeof(INPUT));to input a mouse click, but the code mouves the cursor. is there a way without moving the cursor?
[571 byte] By [
dave2k] at [2007-11-19 22:48:18]

# 2 Re: sendinput
i Didn't Get your Question. if you Simply want to Click Something through your code you can do by Following Example . Which will Generate a Click Event on a Button .
::SendMessage(hwndChild,WM_COMMAND,MAKELONG(00000002,BN_CLICKED),NULL);
//hwndChild handle of the Window
//id of Control to whom you want to click
That's all you have to do.
Thanx
# 3 Re: sendinput
i used double fScreenWidth = ::GetSystemMetrics( SM_CXSCREEN )-1;
double fScreenHeight = ::GetSystemMetrics( SM_CYSCREEN )-1;
double fx = pt.x*(65535.0f/fScreenWidth);
double fy = pt.y*(65535.0f/fScreenHeight);
INPUT Input={0};
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_MOVE|MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_LEFTDOWN;
Input.mi.dx = fx;
Input.mi.dy = fy;
::SendInput(1,&Input,sizeof(INPUT));to input a mouse click, but the code mouves the cursor. is there a way without moving the cursor?
If you dont want to move the cursor why you are passing the MOUSEEVENTF_MOVE flag? :confused:
Simply omit it.
Anyway look at this FAQ (http://www.dev-archive.com/forum/showthread.php?t=377394).
Cheers
# 7 Re: sendinput
let me clarify, i need to click a window at point 10, 10, without moving the mouse cursor from it's current position. all your faq examples seem to involve either moving the cursor or clicking where it is currently.
dave2k at 2007-11-10 23:38:59 >

# 8 Re: sendinput
let me clarify, i need to click a window at point 10, 10, without moving the mouse cursor from it's current position. all your faq examples seem to involve either moving the cursor or clicking where it is currently.
So whats the problem?
Save current cursor position.
Move the cursor to the place you need to click.
Perform the click.
return the cursor back to the saved position in stage A
Cheers