I'm trying to use DirectInput for a windows external. I can successfully
detect and create the device instance, but the problem lies with the
// Set the cooperative level to let DInput know how this device should
// interact with the system and with other DInput applications.
if( FAILED( hr = g_pDevice->SetCooperativeLevel( hWnd_,
DISCL_FOREGROUND ) ) )
It always fails by returning E_HANDLE, which means according to the MSDN:
"The HWND parameter is not a valid top-level window that belongs to the
I've tried 2 different window handles. One from a named jit.window:
jit_object_method(window, gensym("get_window_ptr"), &hWnd_);
and one from the main application:
hWnd_ = main_get_client();
If I print the classname of hWnd_ (calling windows api function
GetClassName()) it returns noise in the case of jit.window, and MDIClient in
the case of main_get_client();
I've also tried to set the flags to DISCL_NONEXCLUSIVE and DISCL_BACKGROUND.
I'm out of ideas. Is there maybe something inherit to the max window handles
that prevent me from using DirectInput devices?