Solved

A working example of mouse movements?

Posted on 2006-11-07
2
962 Views
Last Modified: 2012-06-21
I've tried looking on the web for turorials on how to move my mouse cursor to a certain location and then simulate a clicking.  Much like the macro programs you can download.  I myself want to create my own macro, but instead of downloading a program, i'd like to do it myself for the learning experience.

Is there anyone here that could give me a fully working example in C++ (start to finish) that takes the mouse cursor and moves it to xxx, yyy coordinates and then simulate it double clicking?  I learn the best when I can see an example script :(  Sorry if its too much to ask, sounds relativelty simple I suppose.

Thanks, I use bloodshed c++ compiler.

0
Comment
Question by:Whipsmack
[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
  • 2
2 Comments
 
LVL 12

Accepted Solution

by:
rajeev_devin earned 140 total points
ID: 17895339
>> Is there anyone here that could give me a fully working example in C++
You won't find any such API to do so in C++.
As these type of things are platform dependent.
 
In windows you have these functions

VOID mouse_event(
  DWORD dwFlags,         // motion and click options
  DWORD dx,              // horizontal position or change
  DWORD dy,              // vertical position or change
  DWORD dwData,          // wheel movement
  ULONG_PTR dwExtraInfo  // application-defined information
);

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputfunctions/mouse_event.asp


UINT SendInput(
  UINT nInputs,     // count of input events
  LPINPUT pInputs,  // array of input events
  int cbSize        // size of structure
);

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/sendinput.asp
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17895344
If you are in windows platform then you can use these two function in bloodshed c++ compiler.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

724 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