TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Chris Mcbrien
from: Russell Coker
date: 1994-08-06 14:45:00
subject: 32-Bit Input

CM>I know that IBM would like us all to leave behind the 16-
CM>bit APIs infavour of the new 32 enviroment.  And that, in 
CM>that spirit, we are no longer supposed to be using 
CM>functions such as KBD* and VIO*, for user I/O.

   The next version of OS/2 should support 32 bit KBD* and VIO* APIs. 
DevCon 3 had some DLLs that emulate the new 32 bit VIO/KBD APIs on top of
the existing 16 bit APIs.  Write to the 16 bit KBD API now and do a quick
re-compile of your code in 6 months time when the new 32 bit KBD APIs are
available.

CM>I would like to write a full-screen/windowed text 
CM>application.  And I would like to use the all 32-bit APIs.  
CM>So I have opened the keyboard with
CM>        DosOpen("KBD" [etc]);

   You need some DosDevIOCtl() calls to change the input mode to
non-blocking.

CM>However, I'm not sure how usefull this is going to be.  I 
CM>know that I should get user input useing 
CM>        DosRead();
CM>With the HFILE returned from the function above.

CM>However, how do I retrieve just one character?  For 
CM>example, is the simple situation of "Press any key to 
CM>continue".

CM>The DosRead function on the Keyboard device, won't return 
CM>until it encounters a newline character!

   The API function KbdCharIn() is probably best for your usage.  Also you
don't need to open the keyboard, just use keyboard handle 0.  This makes
your program smaller and easier to write, and also avoids the problems that
can occur if you don't close a keyboard handle.
   When I first started using the KBD API functions I was opening the
keyboard every time but not closing it (due to a bug in my program).  After
a number of test runs I found that my program could not use the keyboard
from that AVIO window as there were too many open keyboard handles....  The
solution was simply to exit the window and open another window (so it
wasn't a major problem).


   cya
___
 X MR/2 2.0 NR X I went window shopping...and bought OS/2!

--- Maximus/2 2.01wb

* Origin: Multi - 61-3-739-7145 (3:633/363)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/301 341 348 365 386 998 633/104 252
SEEN-BY: 633/260 357 363 371 373 379 634/384 635/210 502 503 636/100 638/100
SEEN-BY: 640/820 690/660 711/409 413 430 807 808 809 934 942 712/353 623
SEEN-BY: 713/888 800/1
@PATH: 633/363 260 371 635/503 632/348 711/409 54/54 711/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™.