Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

porting OS/2 to Windows

27 views
Skip to first unread message

tho...@antispam.ham

unread,
May 20, 2016, 9:52:48 PM5/20/16
to
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.

Marcel Mueller

unread,
May 21, 2016, 5:07:27 AM5/21/16
to
The console API in Win is distinct from the GUI API.
ReadConsoleInput/PeekConsoleInput might be your friends.


Marcel

tho...@antispam.ham

unread,
Jun 28, 2016, 12:25:52 AM6/28/16
to
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.

0 new messages