• 0

[C/C++] Mouse functions with windows.h


Question

So for a project i am doing i am making a mouse type device and i got all the way to sending hardware data to a c++ program (through com port, but that's not related to what i am asking)

Whatever that data is, is raw data that can i do whatever i want with.

I want to simulate all the mouse functions from basic mouse movement to scroll wheel and even *ghasp* left and right mouse clicks.

so far I've been using windows.h and i think this can be done with windows.h but i'm not certain. i am open to using any other libraries (as long as it's not third party).

thanks for the help

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

I'm not clear about what is ur goal but this is what I understood

Ur building a new type of hardware that should be replacing mouse and it is connected to ur COM port.

You where able to read the data that is sent with that device u built. Now u want to make use of that device in some application ur building.

If so

in ur application read the data from the COM port eg : lets say ur trying to click with ur device

simply try to send the correct msg to ur window using SendMessage API

here is a list of mouse Notifications u can send

http://msdn.microsoft.com/en-us/library/dd458632(VS.85).aspx

Link to comment
Share on other sites

  • 0

You can simulate mouse input with SendInput, but ideally your device should expose itself as a pointing device through a driver (there are some examples in the DDK).

If adding a USB controller to your hardware is an option, I would seriously consider doing that. Implementing it as USB Human Interface Device would get you instant plug-and-play on all modern OSes with no need for additional drivers or software.

Link to comment
Share on other sites

  • 0

Thanks for the help so far. I've been reading about SendInput and i even found some sample code that help me started

i got a question kind of specific to SendInput:

what is MOUSEEVENTF_XDOWN?

in this MSDN?

what button is X?

also what is time for in that same page? i dont quite get the use of it if i were to send out a time to Sendinput.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.