Detect Touchpad event in C++ Builder

1.4k views Asked by At

I am writing an API in C++ Builder that collects information for events on the touchpad of a windows laptop. This is how I was doing it.

  • I was creating a window
  • when the touch pad is touched, I simply paint that information on that window in WM_PAINT event.

But now I dont want to create that window (form), i want to catch all the events, even if user is on desktop screen or on another application's window. If an application that is using my API is running in background i want to be able to get that touch even information in the code. How can I do that?? I hope you are getting my point ... actually i want to do it in a seamless way, otherwise that white form window will irritate the user. I also want to save these events in a link list and want to return that out of the API is it possible?? I will be very thankful for your time. I really need to work it out in next few hours.

1

There are 1 answers

0
Remy Lebeau On

The touchpad is just a mouse like any other. It generates standard mouse events. Use a global WH_MOUSE hook via SetWindowsHookEx() to capture mouse events globally. To replay them, use mouse_event(). Alternatively, use WH_JOURNALRECORD and WH_JOURNALPLAYBACK hooks instead for capture and playback, respectively.