Click to See Complete Forum and Search --> : MFC window and DirectInput


Novative
March 6th, 2006, 07:02 AM
Hey out there ! :)

I am currently writing a little MFC application with a 3D preview (child-) window. While the OpenGL-Code, I use runs smoothly, I am having trouble setting up a DirectInput device for my keyboard. Every time I try to set the cooperative level of the input device I get an error stating "E_HANDLE", which -at least to me- seems to indicate that my window handle is invalid.

I tried setting the window handle to my applications (top)window, but not even this helped.

When I write a standalone application without MFC, the same input code works fine.

Am I missing something obvious here ? Checked error codes on every call before and they seem to work properly up to that point.

BTW. : I am new to DirectInput :S


Thanks in advance for any ideas/suggestions,

Novative

nolxev
March 6th, 2006, 05:07 PM
I have always used WM messages to handle the mouse...

Novative
March 7th, 2006, 04:02 PM
Hey there ! :) Thanks for the reply, maybe I really fall back to windows messages, I just have 3rd party code using DI, thus it would have been nice if I could have just used it out of the box ...
I even managed to get DI partly running, unfortunately, it seems to require a toplevel- window-handle to function properly (which means DI takes control over my whole application window) and I have not found a way yet to restrict it to the child window I want to use it in ...

Any further suggestions on the subject welcome :)

Novative