Article View: borland.public.cppbuilder.nativeapi
Article #16593checking status of key pressed
From: Luiz Rafael Culik Guimaraes
Date: Thu, 08 May 2003 14:08
Date: Thu, 08 May 2003 14:08
63 lines
2091 bytes
2091 bytes
Hi friends
I use this function on old dos days to determine is an key was pressed
#define TECLA_SHIFT_D 0
#define TECLA_SHIFT_E 1
#define TECLA_CTRL 2
#define TECLA_ALT 3
#define TECLA_SCROLL_LOCK 4
#define TECLA_NUM_LOCK 5
#define TECLA_CAPS_LOCK 6
#define TECLA_INSERT 7
#define SEGMENTO_OFFSET 0x00400017
bool kbstatus( int nKey){
int nStatus;
nStatus = ( int ) ( ( *( char * ) SEGMENTO_OFFSET ) );
return (KeyStatus(nStatus,nKey);
}
int KeyStatus( int nStatus, int nKey )
{
int lStatus;
int hKey;
switch(nKey){
case TECLA_SHIFT_D:
hKey = 0x1;
break;
case TECLA_SHIFT_E:
hKey = 0x2;
break;
case TECLA_CTRL:
hKey = 0x4;
break;
case TECLA_ALT:
hKey = 0x8;
break;
case TECLA_SCROLL_LOCK:
hKey = 0x10;
break;
case TECLA_NUM_LOCK:
hKey = 0x20;
break;
case TECLA_CAPS_LOCK:
hKey = 0x40;
break;
case TECLA_INSERT:
hKey = 0x80;
}
return(nStatus & hKey);
}
but on win32 is not working, that iļæ½m doing wrong
Regards
Luiz
Technical Details
Message-ID:
<3eba64ce@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,b03ceb7f5cbac12d,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-08 07:13:05 PST From: "Luiz Rafael Culik Guimaraes" <culikr@uol.com.br> Newsgroups: borland.public.cppbuilder.nativeapi Subject: checking status of key pressed Date: Thu, 8 May 2003 11:08:25 -0300 Lines: 65 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 200.102.67.237 Message-ID: <3eba64ce@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1052402894 200.102.67.237 (8 May 2003 07:08:14 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail