Acquiring DirectInput with a Console Application
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.
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.
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.
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.
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
Popular Topics
Advertisement