Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

A working example of mouse movements?

Posted on 2006-11-07
2
Medium Priority
?
966 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 560 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

636 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