Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raw Input API Scope of use in Windows 7 / Vista OS. Can it apply to the entire environment or just on the focused window?

Tags:

c#

.net

vb.net

sdk

api

Overreaching amateur developer that is outsourcing some of my work and doing part of it as well. I've been working on a dictionary/ thesaurus / spell check & suggestion application that I am trying to get to work on all applications within the windows environment.

I've used hooking to get key stokes and show output as the person is typing for definitions and spelling suggestions. This isn't accomplishing everything I want. Works fine for spell checking and suggestions but to click on a word that already exists or for touch screen interfaces to touch a word it doesn't work.

I was reading the Raw Input API on MSDN and thought that would work but my developer that I've hired is advising me that the RAW input's scope is only on the window that has focus and so cannot do low level hooking. I'm considering giving the effort but wanted a 2nd third fourth perspective prior to making the effort.

MSDN Reference: http://msdn.microsoft.com/en-us/library/ff468896%28v=VS.85%29.aspx

Hope all the background info doesn't take away from the question. Appreciate your insight.

Regards,

John

like image 434
John Avatar asked Nov 04 '22 15:11

John


1 Answers

Yes, he is right. RawInput messages (WM_INPUT) are only generated for the focused window. Maybe you can somehow work around that, but this is not the main problem.

RawInput really gives you, as it's name says, the raw mouse data. This data is only relative mouse-movement or mouse-delta data. The values are still fed into the message when the mouse reaches the edge of the screen, and most importantly for your case: it doesn't give you pointer ballistics (for some explanations on pointer ballistics see this article: http://msdn.microsoft.com/en-us/windows/hardware/gg463319 ). This makes it pretty impossible to determine the actual cursor position.

You could now try to simulate all this behavior, and simulate the cursor position, but pointer ballistics are not the same on different versions of windows. XP has different behavior than Vista, and I think they changed the formular again in Windows 7.

The API suggests, that there are devices, that give you positional instead of relative data, but I've never come across a device that exhibits this behavior, not even touch screens (although this is probably driver dependent), and it certainly doesn't work for a standard mouse.

like image 160
Tobias Schlegel Avatar answered Nov 09 '22 15:11

Tobias Schlegel