Acquiring DirectInput with a Console Application

Started by
6 comments, last by haro 20 years, 10 months ago
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.
Advertisement
Anybody have an idea?
Hoping at least one other person has tried this
Are there some parameters you need to specify, or you CAN''t specify creating the object?

.lick
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.
I mean that maybe the consolewindow cant handle for instance, background & exclusive?

.lick
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.

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.

This topic is closed to new replies.

Advertisement