Archived

This topic is now archived and is closed to further replies.

haro

Acquiring DirectInput with a Console Application

Recommended Posts

Is it possible to associate DirectInput with a console application? I am using GetConsoleWindow() and GetModuleHandle() to get the window''s handle and the app''s instance, which should be enough to acquire a Direct Input device for the console window. However, when I attemp to acquire the device for the first time I am unable to access it. This doesn''t seem to make much sense. Is there any specific reason MS prevents you from using DirectInput with console windows, or am I blundering somewhere? Thanks alot.

Share this post


Link to post
Share on other sites
Everything works fine, I get the handle to the window from GetConsoleWindow() and I get instance from GetModuleHandle(NULL). The only problem is that the call to Acquire() fails and always fails.

Share this post


Link to post
Share on other sites
Did you try background non-exclusive?
When are you trying to acquire? The only time I acquire is when an update fails. This way, I know I have an active window.

Share this post


Link to post
Share on other sites
WOOHOOOOOOOO!!!!!!!! =)

It was as trivial as changing the mode from FOREGROUND to BACKGROUND!!!! This makes my console programming about 10billion times easier since I can now treat it exactly as I treat window apps with my engine...

I was dreading having to rewrite an entire input subsystem using the nasty peek/constant buffered standard crap. Thanks a whole lot for the help.

As it goes, its always the little things that kill.

Share this post


Link to post
Share on other sites