Solved

MouseClick at location

Posted on 1998-11-15
7
250 Views
Last Modified: 2010-04-01
Experts,
   Forgive me for asking a simple questions. After
moving cursor to a particular location (using SetCursorPos(x,y)), Is it possible to left mouse click (automation) at that position. I would like to write a program to click on "Get Quote" button every minute on an online brokers screen.

Thanks
0
Comment
Question by:fromind
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 1177928
Well, you could use 'WindowFromPoint()' (and/or 'ChildWindowFromPoint()') to retieve the button's window handle and post a 'WM_LBUTTONDOWN'...
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1177929
SendMessage(ThehandleOfTheButtonToBeClicked, WM_LBUTTONDOWN);
SendMessage(ThehandleOfTheButtonToBeClicked, WM_LBUTTONUP);

This would make a click  on the button...
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1177930
A cumulation of the above two answers gives you... (in MFC that is...)

CWnd* wndGetQuote = WindowFromPoint( CPoint( ptX, ptY ));
wndGetQuote->SendMessage( WM_LBUTTONDOWN );

There shouldn't be a reason for SetCursorPos.

Phillip

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
wyy_cq earned 200 total points
ID: 1177931
1.the the window handle under the point
WindowFromPoint(...) or ChildWindowFromPoint()
2.send the mouse button down to the window,if you own the handle of the window you can send and message or command to it.
SendMessage(....)
0
 
LVL 86

Expert Comment

by:jkr
ID: 1177932
wyy_cq - i think it is _NOT_ a good habit at all to simply post my comment as an answer!!!
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1177933
Especially when you do a WORSE job than the original!
0
 

Author Comment

by:fromind
ID: 1177934
Thanks for the suggestions. It Worked.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Would like to move button in a function 3 93
sorting efficency of sorting algorithm 30 151
VS2015 Redefinition errors 4 104
boost::uuid crashes 17 63
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question