943,527 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 28776
  • C RSS
Jun 26th, 2004
1

how to simulate mouse movement and click

Expand Post »
Hi,
I am creating a program that analyses a GUI within Windows XP environment.I am using Java to do all the Guis and other bits. Also, I use Java Native Interface to talk to Windows API. I am having a few problems. I need to make a mouse pointer move across on top of a program such as word, IE,etc in the windows XP environment and click a specified button.
How do I make a mouse move to a specified point and click?
eg, moveMouse(int x, int y);
IF you could give me tips, sample codes or working codes, that would be great.
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
oujmjyu is offline Offline
2 posts
since Jun 2004
Jun 26th, 2004
1

Re: how to simulate mouse movement and click

If you know the window to send them to, you can use WM_MOUSEMOVE and WM_MOUSEACTIVATE. But you have to know the HWND. One way to do that is to use EnumWindows and EnumChildWindows to find the button in the app you are looking for.

Another approach is to pick an x,y and call WindowFromPoint() or ChildWindowFromPoint, and then with the HWND that returns, send IT the WM_MOUSEMOVE or WM_MOUSEACTIVATE.

Hope that gives you a starting point.
Reputation Points: 36
Solved Threads: 11
Posting Pro in Training
Chainsaw is offline Offline
436 posts
since Jun 2004
Jun 29th, 2004
1

Re: how to simulate mouse movement and click

Reputation Points: 11
Solved Threads: 0
Newbie Poster
foolpanda is offline Offline
2 posts
since Jun 2004
Jul 2nd, 2004
0

Re: how to simulate mouse movement and click

Thanks.. Let me try this and get back to you..

Man... There are so many good people other...
Reputation Points: 11
Solved Threads: 0
Newbie Poster
oujmjyu is offline Offline
2 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Need help on a program (function bug)
Next Thread in C Forum Timeline: 10, 20, 0





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC