[comp.lang.c++] show profile

android@ccwf.cc.utexas.edu (Andy Wilks) (06/18/91)

In article <1991Jun17.171243.579@gw.wmich.edu> 32lim@gw.wmich.edu writes:
)Hello all,
)	Here's a Turbo C++ question for you guys.
)	How do I scan for a function key?
)	including a CTRL , ALT and SHIFT and then the FUNCTION KEY
)	I've tried the getch() but that doesn't seem to work.
)so HELP!

Check the keyboard status bits at absolute address 40:17h, or use
BIOS int 16h, function AH=02. Output is return in AL, bit 2 is CTRL
pressed.

)---
)No signature necessary =)

Why not???

/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
*   I don't express opinions, I just follow orders...             (___)   *
/                                                                 (o o)   /
*   Andy Wilks                   One of the few .sig's->   /-------\ /    *
/   andy@fiskville.mc.utexas.edu   with ASCII livestock.  / |     ||O     /
*   android@ccwf.cc.utexas.edu                           *  ||,---||      *
/   University of Texas at Austin                           ^^    ^^      /
*   copyright (c) 1934,1942,1961,1990,1991                    BEVO        *
/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
 

sorrow@oak.circa.ufl.edu (06/18/91)

Although this is not a C++ question, I'll answer anyway since I'm such a 
nice guy. :-)

Use getch().  If it returns 0, then it is an extended key.  Getch() again.
This is the scan code.  Make an include file with definitions for the
scan codes and add these to 256 to make a final key definition.  Example:

/*

Simple code to get key codes.  If it is a "normal" key getch() will work
fine.  OTherwise, getch() will return 0 and you must get the next key out
of the buffer.

*/

#ifndef __CONIO_H
#include <Conio.h>
#endif

#ifndef __STDIO_H
#include <stdio.h>
#endif

void main ( void )
{
int TheKey;

   while (1) {
     if ((TheKey=getch())==0)
        TheKey=getch()+256;        // Extended scan code
     printf("The key is %i\n",TheKey);
   }
}


You may wish to look at the bioskey() function also.

Brian
/*
Brian Hook -- MS-DOS Programmer for Contract
-----------------------------------------------------------------
"Seamus, that's my dog...I saw her today at the reception...sorry, sixTEEN
inches....better save the women and children first...but this one goes to 11!
..anymore of that plutonium nyborg?....there can be only ONE!....like a 
finger pointing to the moon....ease the seat back...one day closer to death
*/

32lim@gw.wmich.edu (06/19/91)

Thanx for all the helps.