🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages Started by Luiz Rafael Culik Guimaraes Thu, 08 May 2003 14:08
checking status of key pressed
#16593
Author: Luiz Rafael Culik Guimaraes
Date: Thu, 08 May 2003 14:08
63 lines
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
Re: checking status of key pressed
#16600
Author: Remy Lebeau (TeamB)
Date: Thu, 08 May 2003 16:43
11 lines
1185 bytes
"Luiz Rafael Culik Guimaraes" <culikr@uol.com.br> wrote in message
news:3eba64ce@newsgroups.borland.com...

> but on win32 is not working, that i�m doing wrong

Use the GetKeyState() or GetAsyncKeyState() function from the Win32 API
instead.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads