Ermittlung von Tastaturcodes
Das folgende kleine Programm kann verwendet werden, um Tastaturcodes
unter Windows herauszufinden. Falls eine Sondertaste wie Funktionstasten
oder Cursor-Steuertasten gedrückt wird, werden zwei Codes angezeigt.
#include
#include
using namespace std;
int main()
{
const int Escape = 0x1b;
int Code;
cout << "Programm zur Erfassung von Tastaturcodes\n\n"
<< "Sie beenden das Programm mit der Taste Esc.\n"
<< endl;
do
{
Code = _getch();
if (Code==0 || Code==224)
cout << Code << " und " << _getch() << endl;
else
cout << char(Code) << ": " << Code << endl;
} while (Code!=Escape);
cout << endl;
return 0;
}
|
Sie können das fertige Programm auch
herunterladen
(88 KByte).