Question

I'm pretty bored this weekend.

I've decided to build a morse code application where I can use my trackpad to tap morse code in and have my app sound it out.

I told you I was bored! :D

Is there some defacto way to access a trackpad in C#? I mean using pressure graphs. Thanks!

Was it helpful?

Solution

I am not familiar 100% with the idea of the trackpad, but I am assuming that the machine you are working with is a laptop, and what you are referring to is something otherwise known as "mousepad".

You can do a couple of things at least in windows. When you tap with your finger you are actually sending "click" events to the windows runtime. If you hold

In .NET any object (Forms/UserControls) that inherits from System.Windows.Forms.Control can subscribe to the following events:

  • MouseDown
  • MouseUp
  • MouseEnter
  • MouseLeave
  • MouseClick
  • MouseDoubleClick

You can time the Difference in time between MouseUp and MouseDown events and react to the resulting timespan ranges. For instance if you hold the mouse for 20 milliseconds then this is some morse-code character, while holding the mouse for 40 milliseconds is some other character.

In the case of the mousepad/trackpad this would be the equivalent of holding your finger on the pad itself.

OTHER TIPS

Some tabs drivers use the mouse input message extra info to send, well, extra information. I think WACOM does this for sending pen pression.

This information can be queried using the GetMessageExtraInfo Function

Maybe you should check if there's something interesting with your pad, but it's probably vendor specific, if anything is even available which is not certain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top