Registering a raw input device...

SephirothSephiroth Fayetteville, NC, USA
Alright, I am playing with raw input devices and have hit a roadblock that makes no sense to me. When I attempt to register the device, I get error 87, which I was told means "invalid parameter". I checked on the MSDN and my parameters are correct, so I am stumped. I am trying to get this to work with a local window that I created using "CreateProcess". When it wouldn't work with that window, I started trying other windows, such as Notepad windows and even games, and nothing will register! I was hoping somebody here could help me figure out if the function itself is completely broken in VS2005.
//Setup the raw input device flags
memset(&ridDevice, 0, sizeof(RAWINPUTDEVICE));
ridDevice.usUsagePage = 1;
ridDevice.usUsage = 6;
ridDevice.dwFlags = RIDEV_INPUTSINK;
ridDevice.hwndTarget = hwndTarget;

//Attempt to register the raw input device
if(RegisterRawInputDevices(&ridDevice, 1, sizeof(RAWINPUTDEVICE)) == 0)
return false;
That is my configuration process. No matter what window-handle I pass to this thing, it fails to register. What gives?


Figured out one problem. Upon checking the window-handle I was getting and passing to it, it was NULL. I use "EnumWindows()" to enumerate all windows and compare their process IDs to the one I have for the process that I created, and then use that window-handle.

Here's where it gets odd. My process ID is valid, verified by looking for the process ID by executable. I find my executable in the process-list and it has the same ID, but when enumerating through all the windows, not a single window has that ID! I am completely lost at this point. Any help would be very much appreciated.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!