Sign in to follow this  
MrCodeSushi

How to use IDirectInputDevice8::SetEventNotification?

Recommended Posts

MrCodeSushi    1066
Hello,

Does anyone know how to use the IDirectInputDevice8::SetEventNotification() function? Or specifically how to set the event notification thing up. According to MSDN the function accepts a HANDLE which can be created from calling Win32's CreateEvent() function.

My init code for SetEventNotification is:
[code]

m_eventHandle = CreateEvent( NULL, FALSE, TRUE, "KeyboardDirectInputEventHandle" );
DWORD err = GetLastError();
HRESULT hRes = m_pKeyboardDevice->SetEventNotification( m_eventHandle );
[/code]


Then my code for checking if there's an event is:
[code]

DWORD dwResult = WaitForSingleObject( m_eventHandle, 0 );

if ( dwResult == WAIT_OBJECT_0 )
{
// Poll
}
[/code]

My problem is that it never goes inside the if statement. Another thing i noticed is that the handle returned by CreateEvent() function is 0x000000f0. I'm wondering since it's not NULL but why is the address so close to NULL. I also tried calling GetLastError after CreatEvent and SetEventNotification() but GetLastError() doesn't return anything(0).

Any help would greatly be appreciated.

Cheers!

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