Solved

Utility to display keyboard key codes when I press keys

Posted on 2003-10-21
4
782 Views
Last Modified: 2012-06-27
Howdy,

Does anyone know of a utility that will display the code that is transmitted by the keyboard when a key is pressed?

Thanks,

Mike
0
Comment
Question by:flakrat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 9595973
Not off-hand, but it would be easy to write.  Are you looking for code in any particular language, or just an executable?

Which OS?

0
 
LVL 22

Accepted Solution

by:
cookre earned 50 total points
ID: 9596099
FWIW, here's an MS C console app that does just that:

#include "stdafx.h"
#include <conio.h>
#include <stdio.h>
char c;

int main(int argc, char* argv[])
{
c=0;
// Drain keyboard buff
while (_kbhit()) _getch();

// Keep going until = is hit
while (c!='=')
      {
      // Note that CTRL-C (3) is not caught here
      if (_kbhit())
         {
         c=_getch();
         if (c==0 || c==0xe0)
            {
            // Special key
            c=_getch();
            printf("* %d\n",c);
            }
         else
            {
            printf("%d\n",c);
            }
         }
      }
return 0;
}

0
 
LVL 5

Expert Comment

by:fantasy1001
ID: 9596560
This is the Visual Basic one:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    MsgBox "Key Pressed: " & KeyCode
End Sub
0
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9597701
if you need in any other languages let me know
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Android development question 2 107
Select specific duplicate row based on specific criteria 4 82
AvlTree-Node Data type 4 44
How do I buy BitCoin? 4 23
This article will show, step by step, how to integrate R code into a R Sweave document
This is an explanation of a simple data model to help parse a JSON feed
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question