I've registered my raw input devices successfully but Windows doesn't send me the WM_INPUT message when I press keys or do things with the mouse. I am using an event hook to get the messages since I'm using SDL and it receives other messages fine.

This is the code I have to register my raw input devices:

bool CInput::Init( void )
{
	RAWINPUTDEVICE Rid[2];

	// Keyboard
	Rid[0].usUsagePage = 1;
	Rid[0].usUsage = 6;
	Rid[0].dwFlags = 0;
	Rid[0].hwndTarget = NULL;

	// Mouse
	Rid[1].usUsagePage = 1;
	Rid[1].usUsage = 2;
	Rid[1].dwFlags = 0;
	Rid[1].hwndTarget = NULL;

	if( !RegisterRawInputDevices( Rid, 2, sizeof( RAWINPUTDEVICE ) ) )
		return false;
	return true;
}

And this is my message hook. Note that if windows send any other type of message this function gets called.

LRESULT HookProcedure( int nCode, WPARAM wParam, LPARAM lParam )
{
	//Get the message info.
	CWPSTRUCT *info = (CWPSTRUCT*)lParam;

	//Use the raw input data.
 	if( info->message == WM_INPUT )
	{
		//Don't use the message if the application was in the background.
		if( info->wParam == RIM_INPUTSINK )
			return CallNextHookEx( NULL, nCode, wParam, lParam );
		input->InputRecieved( info->lParam );
	}

	return CallNextHookEx( NULL, nCode, wParam, lParam );
}

This is how I set the hook.

sys_hook = SetWindowsHookEx( WH_CALLWNDPROC, (HOOKPROC)HookProcedure, NULL, GetCurrentThreadId( ) );

Raw input is available only when the application calls RegisterRawInputDevices with valid device specifications

See this link and read the Remarks at the bottom.

I don't know what you're trying to get me to see because the call to RegisterRawInputDevices succeeds.

You didn't mention in your original post that you had called that function, so I'm just bringing it to your attention. If you've already called that function then I don't know what the problem could be.

Okay, thanks for your help anyway.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.