Sign in to follow this  
NickUdell

SlimDX RawInput and WPF

Recommended Posts

I'm trying to set up keyboard and mouse controls for a space game using SlimDX and RawInput. My current code is as follows:

 

Device.RegisterDevice(UsagePage.Generic, UsageId.Keyboard, DeviceFlags.None);
Device.KeyboardInput += new EventHandler<KeyboardInputEventArgs>(keyboardInput);
Device.RegisterDevice(UsagePage.Generic, UsageId.Mouse, DeviceFlags.None);
Device.MouseInput += new EventHandler<MouseInputEventArgs>(mouseInput);

 

 

However I read here: http://code.google.com/p/slimdx/issues/detail?id=785 that for WPF I need to use a different overload for Device.RegisterDevice(), as well as assigning a HandleMessage using Device.HandleMessage(IntPtr message)

 

I've found the correct overload for RegisterDevice() which is:

RegisterDevice(UsagePage usagePage, UsageId usageId, DeviceFlags flags, IntPtr target, bool addThreadFilter)

 

 

 

What I can't work out, though, is:

 

1) Now that I have to use a target, what am I meant to set as a target?

2) Where do I get this IntPtr message from?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this