Is it doable,

S

s.eng.ashraf

Hi everybody,

Is it possible to control the mouse action by a C++ program.

For example,

MousePosition(x_location = 100, y_location = 120)

To make it more clear,
I might be able to check my email through is C++ program, by
controlling the mouse positions and actions.
Or I might be able to rename thousands of Excel files and change
specific cells in each file by a simple program.

It is like “windows automation”
I found many programs that can do this function, but if I am able to
do it through C++, then I am able to do more functions as adding more
complex calculations.


Regards,
 
M

Matthias Buelow

s.eng.ashraf said:
I might be able to check my email through is C++ program, by
controlling the mouse positions and actions.
Or I might be able to rename thousands of Excel files and change
specific cells in each file by a simple program.

Intriguing how the shortcomings of a badly thought out interface design
bud the strangest flowers...
 
R

red floyd

s.eng.ashraf said:
Hi everybody,

Is it possible to control the mouse action by a C++ program.
Yes but...
For example,

MousePosition(x_location = 100, y_location = 120)

To make it more clear,
I might be able to check my email through is C++ program, by
controlling the mouse positions and actions.
Or I might be able to rename thousands of Excel files and change
specific cells in each file by a simple program.

It is like “windows automation”
I found many programs that can do this function, but if I am able to
do it through C++, then I am able to do more functions as adding more
complex calculations.
This question is off-topic here. Please ask in a newsgroup with either
"windows" or "microsoft" in its name.

See FAQ 5.9 (http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9)
 
J

Joe Greer

Hi everybody,

Is it possible to control the mouse action by a C++ program.

For example,

MousePosition(x_location = 100, y_location = 120)

To make it more clear,
I might be able to check my email through is C++ program, by
controlling the mouse positions and actions.
Or I might be able to rename thousands of Excel files and change
specific cells in each file by a simple program.

It is like “windows automation”
I found many programs that can do this function, but if I am able to
do it through C++, then I am able to do more functions as adding more
complex calculations.


Regards,

C++ doesn't give you any ability to do mouse control. It's quite likely
your OS does, however, and you should properly address the question in a
more specific group like one of the microsoft groups or one of the X
windows groups if that is where you are targeting.

In general, yes you can move the mouse pointer about. This doesn't
accomplish much though since you will be bypassing the mechanisms that send
the various mouse messages to the applications. You will have to do that
yourself if you want the application to respond as if a user moved the
mouse. (There are several messages that need to be sent, don't stop at the
high level WM_MOUSEMOVE messages there are also messages that allow the app
to change the cursor etc.) When it comes to mouse clicks, you will have to
determine the app under the cursor and generate a WM_COMMAND message (or
whatever) with the appropriate info and send it to the app. There are
undoubtedly ways to do all that, but I am just ensuring that you know there
are a lot of details to be worked out and not much will happen
automatically.

joe
 
S

s.eng.ashraf

(e-mail address removed):












C++ doesn't give you any ability to do mouse control.  It's quite likely
your OS does, however, and you should properly address the question in a
more specific group like one of the microsoft groups or one of the X
windows groups if that is where you are targeting.

In general, yes you can move the mouse pointer about.  This doesn't
accomplish much though since you will be bypassing the mechanisms that send
the various mouse messages to the applications.  You will have to do that
yourself if you want the application to respond as if a user moved the
mouse.  (There are several messages that need to be sent, don't stop at the
high level WM_MOUSEMOVE messages there are also messages that allow the app
to change the cursor etc.)  When it comes to mouse clicks, you will have to
determine the app under the cursor and generate a WM_COMMAND message (or
whatever) with the appropriate info and send it to the app.  There are
undoubtedly ways to do all that, but I am just ensuring that you know there
are a lot of details to be worked out and not much will happen
automatically.

joe- Hide quoted text -

- Show quoted text -

Thank to all of who tried to help me,,

I worked on C, and I am not saying that I am an expert on it.
And my little idea tells me that: this is C language, it can do any
thing. And I know my target Mr. red floyd.

The program should include a lot of details as what Mr. Joe said,
But is there any body tried to work on mouse controlling? ,, from
where to start?

Regards,
 
J

Jim Langston

s.eng.ashraf said:
Thank to all of who tried to help me,,

I worked on C, and I am not saying that I am an expert on it.
And my little idea tells me that: this is C language, it can do any
thing. And I know my target Mr. red floyd.

The program should include a lot of details as what Mr. Joe said,
But is there any body tried to work on mouse controlling? ,, from
where to start?

Regards,

Where to start is in a newsgroup appropriate for your OS, because it'll be
different in each. Because you are mentioning excell files we can presume
you are on a windows platform, so microsoft.public.vc.language may be for
you.

But you might just want to google for "winbatch", there are many versions
and they all do the same thing, windows batch programming with mouse
moviement, clicks, etc...
 
V

Vincent Jacques

Hi,

s.eng.ashraf a écrit :
The program should include a lot of details as what Mr. Joe said,
But is there any body tried to work on mouse controlling? ,, from
where to start?

You should really go to a newsgroup about Windows programming.

I remember that there is a specific set of functions in Win32 API for
generating mouse and keyboards events (much more usable and reliable
than sending or posting WM_MOUSEMOUVE (etc.) messages to the target
window). I once used it to play minesweeper :) but I've stopped Windows
programming for a while and I couldn't help you further now.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top