Marcel Mueller writes:
>> What is the closest Windows API analog to the OS/2 API KbdCharIn?
>>
>> I've tried GetKeyState and GetAsyncKeyState, but in a console
>> application, it seems they always return zero.
> The console API in Win is distinct from the GUI API.
I am aware that console apps differ from GUI apps in that the latter
need to process a message queue. But it would be incorrect to say
that console apps are restricted to console APIs. For example, I've
written a console app that calls the PlaySound API. So I would expect
that APIs could be used as long as they don't deal with a message queue,
and I don't recall seeing anything along those lines in the documentation
for GetKeyState. The test program I wrote that calls these APIs certainly
compiles, links, and runs, but it just doesn't behave the way I expected.
> ReadConsoleInput/PeekConsoleInput might be your friends.
One of these days I'll need to give them a try, but I've had zero time
for this programming project the last few weeks. It's important to have
the capability to both block and not block, which GetKeyState and
GetAsyncKeyState seemed to offer. I still haven't figured out why they
always returned zero.