TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Darin McBride
from: Mark Birenbaum
date: 1996-12-25 22:02:24
subject: waiting for keyboard input

DM> void GetKeys(void* pv)
 DM> {
 DM>   KBDKEYINFO CharData;
 DM>     rc = KbdCharIn(&CharData, -1, 0);
 DM>     /* character is in CharData.chChar, scan code in 
     etc...
     Sorry, what I meant is that, I can't seem to use any Kbd functions
from anything other than the primary thread.  It gives me an exception code
0005. 
 I tried using:

     KbdFreeFocus(0); // in the primary thread
and
     KbdGetFocus(IO_NOWAIT,0); // in the secondary thread

but no matter what, and Kbd function causes the exception (include
KbdGetFocus), so I have a funny feeling I'm comepletely out to lunch on
that one.  Anyways, how do I allow a thread other than the original one use
the keyboard?  I can't find any sample code that does this.  In fact, the
one program I do have that has multiple threads, and uses keyboard input,
goes out of it's way to ensure it has the Kbd functions in the primary
thread, (resulting in a requirement for keyboard input to shut down,
something I absolutely can not allow.  My program has to be able to run
with out keyboard input)

--- Nereid - The native OS/2 message editor.

--- Maximus/2 3.01
* Origin: The Foundation - (403) 436-1345 / 437-1617 - (1:342/620)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/311 407 505 506 515 517 624 628 704 824 841 713/317
SEEN-BY: 800/1
@PATH: 342/620 5011 61 3615/50 396/1 270/101 712/515 624 711/808 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™.