Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I would like to get the mouse_move, mouse_down and mouse_up event from my stylus(and optionally if it's hovering or not and pen pressure/tilt). I tried with global hooks, but I can't distinguish the mouse from the stylus. Then I tried with raw input and everything works well until I try to process the raw hid input data(because there's no lastx, lasty etc.). How should I should I do it?
Updated 19-Aug-12 20:22pm
Kenneth Haugland 19-Aug-12 16:51pm    
What?!? On what, where and what chart are you using? And what did you try?
mostwanted4 19-Aug-12 17:02pm    
Running on windows 7 x64, using the multiple keyboards project, the problem is that the hid(unlike mouse and keyboard) only has dwSize and dwCount - I don't know how to get the actual data.

I tried to work with Table input, successfully, using the tablet PC SDK. Tablet PC is a weird kind of Windows version. It was promoted extensively bundled with special Tablet PCs. Apparently, there was no an official way to buy this version to use it for a regular computer with the tablet device or a tablet monitor; it was only available as the OEM product. I regularly met people promoting such PCs in the building of railway station which I use for my commute at that time. Suddenly, all this activity was seized, and most of such PCs disappeared. I regret it too much, as I am a fan of pen input and have good experience in drawing and photo re-touching. (Not only drawing, but even photo re-touching without a tablet is like repairing a computer with an axe). Everything could be downloaded from Microsoft for free, even the hand-writing recognition engine, which works pretty well.

However, with Tablet PC SDK, you don't really need a Tablet PC. One can have all the power of Tablet PC on Windows 2000 and later (and then you can down-load, install and use the hand-writing recognition engine and some other stuff), if this person only have enough knowledge to compile .NET code. The SDK provides and access to individual strokes and pen pressure information. The appropriate events are separate from mouse evens (even though a pen generates the mouse events as well, of course).

Please see:[^].

I have a version of this SDK on my old computer I still use; and it is functional. However, I don't know where to download it. I'll appreciate a link very much.

Share this answer
mostwanted4 20-Aug-12 1:25am    
Thanks for the answer, but as you said I couldn't find any download link.
Sergey Alexandrovich Kryukov 20-Aug-12 3:22am    
Right, sorry about it; but at least it could give you some idea on what's involved...
Sergey Alexandrovich Kryukov 20-Aug-12 3:25am    
And I would not give up. I don't carefully look for this thing because 1) I have a copy; 2) I have a lot more work to do; this is not my current concern; and when I have this concern again, the OS and API may change...

But as this is in your interest, you might need to search for the API or its more modern form (Surface?)...
There is no way to know what input device it came from, in C#. It's just an event, and the system can have more than one device connected, but they all work at the same time, firing the same events.
Share this answer
Sergey Alexandrovich Kryukov 19-Aug-12 22:03pm    
This is certainly not true. You are doing on logical mistake perhaps. Even if you cannot tell one mouse from another one, you cannot tell if a mouse event comes from a mouse or a tablet device (I don't know how to do it), but a tablet device is a device of different type. It has its own, tablet-specific. I used to use them.
Christian Graus 19-Aug-12 22:33pm    
Then it's not going to fire the same events, is it ? I'm pretty sure he doesn't have a high end tablet, he has a big touchpad. If it's a completely different device, then it's not going to act like a mouse at all, and his question would make no sense.
Sergey Alexandrovich Kryukov 19-Aug-12 22:54pm    
Hard to say, looking just at the question if it makes sense or not. The tablet generates some tablet-specific input with pressure-sensitive information, etc. On top of it, the usual mouse events are generated, so the tablet-unaware software could use the input exactly as mouse. This is how it basically works.
Christian Graus 20-Aug-12 7:45am    
So, when it generates the 'usual mouse events', how do you tell they didn't come from a mouse ? That is his question, how does he tell that the mouse events didn't come from a mouse. Reading your answer, I think mine was still correct.
Sergey Alexandrovich Kryukov 20-Aug-12 15:27pm    
If there is no way (I don't know how, maybe impossible), there is no a need to tell one from another. This is the whole point of such architecture. The pieces of code working with tablet are classified into tablet-aware (which handles only the events which cannot come from mouse, only from a tablet) and table-agnostic (which work with it like with mouse, which is not a problem for the purpose of such code). In my opinion, quite logical and reasonable.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900