f



porting OS/2 to Windows

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.

0
tholen
5/21/2016 1:52:44 AM
comp.os.os2.programmer.misc 1326 articles. 0 followers. Post Follow

2 Replies
200 Views

Similar Articles

[PageSpeed] 10

On 21.05.16 03.52, tholen@antispam.ham wrote:
> 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.
ReadConsoleInput/PeekConsoleInput might be your friends.


Marcel

0
Marcel
5/21/2016 9:07:26 AM
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
tholen
6/28/2016 4:25:52 AM
Reply: