Solved

MouseClick at location

Posted on 1998-11-15
7
251 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
Industry Leaders: 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

632 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