TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Vitus Jensen
date: 1995-03-11 00:00:48
subject: Re: 32-bit Input

Hi Paul,

06.03.95 17:24, you wrote a message to Vitus Jensen:

 PE> On Aug 05 01:21 94, Vitus Jensen of 2:2474/100.20 wrote:

Last Summer: Australia is really a long way to travel .

CM>> However, how do I retrieve just one character?  For example,
CM>> is the simple situation of "Press any key to continue".
VJ>> Check your documentation of DosDevIOCtl. Category 4, 
VJ>> Function 0x74 and 0x75 work find here.

CM>> I tried that.  No matter what I did, the DOSDEVIOCTL would
CM>> always return the Invalid Parameter error.  Care to post a
CM>> snippet of the code you used to make this work?
VJ>> Oh, I retried it and DosDevIOCtl returned error 22! Rechecking the dox (I 
VJ>> WANT paper!), I realized that this IOCtl don't work in a PM window!

VJ>> In case Fullscreen is OK for you:

 PE> I didn't think it was possible to be able to write a fullscreen
 PE> application (like MSGED, Binkley, micro-emacs et al) without using 
 PE> the Vio*, Mou* and Kbd* functions, but seeing this message made me 
 PE> think again.  I went and tried your code, and I also got error 22.
 PE> But that was in a fullscreen session.  

You are lucky: I kept the code (but not the message).
Did I post kbhit() and cgetc()? I retried it 5 minutes ago and it still
works (OS/2 2.1GA) in fullscreen. Here is this small test program again
(would someone else please recheck):


----------------------------------------
#include 

#define INCL_NOPMAPI
#define INCL_BASE
#include 

int kbhit(HFILE h)
{
    USHORT para = 0;
    ULONG  para_len = sizeof(para);
    KBDKEYINFO  data;
    ULONG  data_len = sizeof(data);
    APIRET rc;

    rc = DosDevIOCtl( h, 4, 0x75,
                        ¶, para_len, ¶_len,
                        &data, data_len, &data_len );

    if( rc )
        {
        fprintf( stderr, "DosDevIOCtl() returns %u\n", rc );
        DosExit( EXIT_THREAD, rc );
        }
    printf( "CharCode %u = |%c|\tScanCode %u\tStatus %#x\tState %#x\n",
        data.chChar, data.chChar, data.chScan, data.fbStatus, data.fsState );

    return para;
}


int cgetc(HFILE h)
{
    USHORT para = 1;
    ULONG  para_len = sizeof(para);
    KBDKEYINFO  data;
    ULONG  data_len = sizeof(data);
    APIRET rc;

    rc = DosDevIOCtl( h, 4, 0x74,
                        ¶, para_len, ¶_len,
                        &data, data_len, &data_len );

    if( rc )
        {
        fprintf( stderr, "DosDevIOCtl() returns %u\n", rc );
        DosExit( EXIT_THREAD, rc );
        }
    printf( "CharCode %u = |%c|\tScanCode %u\tStatus %#x\tState %#x\n",
        data.chChar, data.chChar, data.chScan, data.fbStatus, data.fsState );

    return (data.chChar==0 ? data.chScan & 0x0100 : data.chChar);
}


int main()
{
    HFILE  h;
    APIRET rc;
    ULONG  action;
    int    c;

    rc = DosOpen( "KBD$", &h, &action, 0, 0,
                    OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
                    OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL );
    if( rc )
        {
        fprintf( stderr, "DosOpen() returns %u\n", rc );
        DosExit( EXIT_THREAD, rc );
        }

    while( !kbhit(h) )
        ;
    c = cgetc( h );
    printf("character |%c|\n", c );

    DosClose( h );
    return 0;
}
----------------------------------------



 PE> I'm not sure if I'm using the same terminology as you, but
 PE> to me:

 PE> PM - graphical program
 PE> Fullscreen - an OS/2 session started by clicking on the "OS/2
fullscreen"
 PE>   icon in PM's "OS/2 System", "Command Prompts" folder.
           WPS ^^
Ok (except it's german on my system)

 PE> OS/2 Window - an OS/2 session started by clicking on "OS/2
window" in
 PE>   PM's "OS/2 System", "Command Prompts" folder.
Agree

 PE> There is another mode, which I don't know how to get into, where PM is
 PE> not even loaded!  I don't have a name for that, because I've never
 PE> known how to do that, if indeed it is possible.

That's the same from an API oriented point of view. Change your CONFIG.SYS
to get a look at them.
----
SET RUNWORKPLACE=c:\os2\cmd.exe
You get the presentation manager with an "OS/2 window" as shell
(use START, DETACH). Type PMSHELL to start the WPS.
There are some alternative shells to be use instead of CMD.EXE (PC2,
MSHELL, FEELX, ...).
----
SET RUNWORKPLACE=c:\os2\cmd.exe
PROTSHELL=c:\os2\cmd.exe
Only "OS/2 fullscreen". Fully functional system (disks, VIO,
network,...) but no "session manager" (try TSHELL) which means
you cannot use START and DETACH. And of course: no PM!


Bye,
	Vitus

--- Sqed/32 0.98/r00228
* Origin: Really a Point of BetaBox, Walheim (2:2474/100.20)
SEEN-BY: 105/42 620/243 624/50 711/401 409 410 413 430 807 808 809 934 955
SEEN-BY: 712/407 515 628 704 713/888 800/1 7877/2809
@PATH: 2474/100 0 2476/2 2452/110 105/42 712/515 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™.