TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Russell Coker
date: 1995-02-04 15:11:10
subject: KbdCharIn(x, 1, 0)

When I do a KbdCharIn(&x, 1, 0) I should be able to check bit 0 of
x.fbStatus to determine whether the KbdCharIn actually returned anything
(according to PRCP.INF).  However this doesn't work, I wrote a tiny program
topoll KbdCharIn() every 2000ms and print out all thhe data and the
following is what I got:

read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=0, char=0, scan=0, state=0, time=1
read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=0, char=0, scan=0, state=0, time=1
read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=0, char=0, scan=0, state=0, time=1
read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=0, char=0, scan=0, state=0, time=1
read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=0, char=0, scan=0, state=0, time=1
read frm Kbd stat=64, char=3, scan=46, state=292, time=92966834
read frm Kbd stat=64, char=103, scan=34, state=32, time=92968771
read frm Kbd stat=64, char=104, scan=35, state=32, time=92971959
read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=0, char=0, scan=0, state=0, time=1
read frm Kbd stat=64, char=103, scan=34, state=32, time=92977428
read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=66, char=0, scan=35, state=814, time=92980740
read frm Kbd stat=0, char=0, scan=0, state=0, time=0
read frm Kbd stat=64, char=106, scan=36, state=32, time=92986334
read frm Kbd stat=0, char=0, scan=0, state=0, time=0


  When time has a value >1 is when I pressed a key.

   OK.  So what is fbStatus doing with the value 64 which seems to indicate
that a key has been pressed?  That bit is labelled as reserved in PRCP... 
Also why is the time variable having alternate values of 0 and 1 when I'm
not pressing a key?

    I've just modified my program to check for a value >1 in the time
field to indicate a key pressed, but I don't think that this is reliable -
what if some other version of OS/2 returns values of 1 and 2 when there is
no key pressed?!

   Later:  That method doesn't work.  Sometimes after the call that
retrieved a key press the next call receives the time...  What should I do?
 Check for fbStat==64?  Or do I have to use a seperate thread doing
KbdCharIn(&x, 0, 0) and use an event semaphore because I can't get this
API call to work as documented?


  I'm using OS/2 Warp 3.0 (not that it should make a difference).


  cya

--- Maximus/2 2.02
* Origin: Multi - 61-3-739-7145 (3:633/363)
SEEN-BY: 12/2442 620/243 624/50 632/103 301 341 348 386 998 633/104 252 260
SEEN-BY: 633/363 371 373 379 634/384 635/301 502 503 636/100 638/100 640/820
SEEN-BY: 690/660 711/409 410 413 430 807 808 809 934 942 949 955 712/515
SEEN-BY: 713/888 800/1 7877/2809
@PATH: 633/363 260 371 635/503 632/348 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.