Jump to content
  • Advertisement
Sign in to follow this  
MrCodeSushi

How to use IDirectInputDevice8::SetEventNotification?

This topic is 2646 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:


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



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


DWORD dwResult = WaitForSingleObject( m_eventHandle, 0 );

if ( dwResult == WAIT_OBJECT_0 )
{
// Poll
}


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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!