Solved

sending mouse clicks to an application?

Posted on 2007-03-27
3
239 Views
Last Modified: 2013-11-20
I'm using Windows XP.  I have an application that I need to start that does not have a COM interface.  After an initial setup, the application will occasionally need some mouse clicks (always the same spot relative to the application window).  What I need is to automatically send a mouse click to that spot.  I don't care if it does it repeatedly in a loop as clicking the area does nothing until the app enables it.

If I could get some small sample code on
1)  Getting a handle to the app (I will have to find the correct app based off of title bar information)
2)  How to send a mouse click to a particular spot relative to where the winapp is positioned
0
Comment
Question by:keenez
[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
3 Comments
 
LVL 16

Accepted Solution

by:
AlexNek earned 250 total points
ID: 18799562
Here is a godd sample, I think
http://www.codeguru.com/Cpp/W-P/win32/article.php/c4543/
You can send WM_MOUSEDOWN / WM_MOUSEUP to your window
 If you need to "press a button" then try to find the button's ID and send the owner window the WM_COMMAND message with that button's ID as the low word of the wParam and BN_CLICKED as the high word.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18801034
A completely different approach:
http://www.autoitscript.com/autoit3/
0
 
LVL 1

Expert Comment

by:i_mahesh
ID: 18805430
You can use SendInput Win32 API to achieve what you are looking for
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.

749 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