home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD2.mdf
/
c
/
library
/
mslang
/
cp1
/
ins1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-10
|
3KB
|
71 lines
===========================================================================
BBS: The Abacus * HST/DS * Potterville MI
Date: 06-06-93 (13:01) Number: 11
From: SID ROGERS Refer#: 137
To: STEVE KLEMETTI Recvd: NO
Subj: Insert Conf: (36) C Language
---------------------------------------------------------------------------
Steve,
Try this.....
#include <conio.h>
#include <stdlib.h>
/* The following Shift Macros, hereby donated to the public domain, were
patterned after a message orignally posted by Ed Kowalski in the
C_Echo conference */
/*** the BIOS shift status byte at 0000:0x417
Bit# 7 6 5 4 3 2 1 0
x . . . . . . . insert state 128
. x . . . . . . caps lock 64
. . x . . . . . num lock 32
. . . x . . . . scroll lock 16
. . . . x . . . alt depressed 8
. . . . . x . . ctrl depressed 4
. . . . . . x . left shift 2
. . . . . . . x right shift 1 */
/* peekb is a Borland Product(s) function */
#define ShiftState peekb(0,0x417)
#define InsertState (peekb(0,0x417) & 128)
#define CapsLock (peekb(0,0x417) & 64)
#define NumLock (peekb(0,0x417) & 32)
#define ScrollLock (peekb(0,0x417) & 16)
#define AltPress (peekb(0,0x417) & 8)
#define CtrlPress (peekb(0,0x417) & 4)
#define LeftShift (peekb(0,0x417) & 2)
#define RightShift (peekb(0,0x417) & 1)
main()
{
int done = 0;
_setcursortype(_NOCURSOR); /* Borland Product(s) function */
clrscr();
while(!done)
{
gotoxy(1,1);
printf("ShiftState == %3u\n",ShiftState);
printf(" Insert == %3u\n",InsertState); /*128 == active */
printf(" CapsLock == %3u\n",CapsLock);
printf(" NumLock == %3u\n",NumLock);
printf("ScrollLock == %3u\n",ScrollLock);
printf(" Altpress == %3u\n",AltPress);
printf(" CtrlPress == %3u\n",CtrlPress);
printf(" LeftShift == %3u\n",LeftShift);
printf("RightShift == %3u\n",RightShift);
if(RightShift) done = 1;
}
_setcursortype(_NORMALCURSOR); /* Borland Product(s) function */
return 0;
}
=== Sid ===
... OFFLINE 1.39 * From here to nowhere..an eternity
---
* Origin: Fire Fly BBS (508)356-2469 Ipswich, MA USA (1:330/173)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20