Question raw mouse data , I am lost...

GvB

New member
Joined
Sep 23, 2012
Messages
4
Programming Experience
3-5
I need to get the raw mouse data in order to get a higher resolution input from the mouse. In the normal way you only get as acurate as pixel resolution, but mice are often much more precise.
I am programming in vb.net visual studio 2010. There seem to be more possibilities (rawinput api, directx, slimdx, XNA, real time stylus api) but I cannot find a start that seems to work. The code needed is each time I found something incomplete, or for another version and to specific for me to convert. I really need it and I am getting pretty frustrrrated and hopeless.

is there someone with experience somewhere?
 
Last edited:

GvB

New member
Joined
Sep 23, 2012
Messages
4
Programming Experience
3-5
Ah.
Getting somewhere...

referred to slimdx version 4 and with following i get the lparam feedback. Still have to decode what lparam consists of but it reacts to mousemovement.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SlimDX.RawInput.Device.RegisterDevice(1, 2, SlimDX.RawInput.DeviceFlags.InputSink, Me.Handle)
    End Sub


    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
    Protected Overrides Sub WndProc(ByRef m As Message)
        ' Listen for operating system messages
        Const WM_INPUT As Integer = &HFF
        Select Case (m.Msg)

            Case WM_INPUT
                Me.Text = m.lparam.ToString
        End Select
        MyBase.WndProc(m)
    End Sub

End Class
 

GvB

New member
Joined
Sep 23, 2012
Messages
4
Programming Experience
3-5
Hmmm. Lparam seems to work but I cannot find how Lparam should be decoded. some pointers someone?

And:
Could it be that stuff doesn't work because I am using visual studio 2010 express which does not have full capabilities as vb.net?
 

GvB

New member
Joined
Sep 23, 2012
Messages
4
Programming Experience
3-5
Ah. lparam is a pointer. that helps. Seems that I should get the data with user32.getrawinputdata.
in c++:
{
RAWINPUT input = new RAWINPUT();
int outSize = 0;
int size = Marshal.SizeOf(typeof(RAWINPUT));

outSize = Win32API.GetRawInputData(m.LParam, RawInputCommand.Input, out input, ref size, Marshal.SizeOf(typeof(RAWINPUTHEADER)));
if (outSize != -1)
{
if (input.Header.Type == RawInputType.Mouse)
{
p.X += input.Mouse.LastX;
p.Y += input.Mouse.LastY;
label1.Text = "Mouse: " + p.X.ToString() + "x" + p.Y.ToString() + " " + input.Mouse.ButtonFlags.ToString();
}
}

now just to vb....

NICE A FORUM WHERE THERE CAN BE A CONVERSATION. SEEMS A BIT ONE-SIDED OVERHERE.......!

 
Top Bottom