ascii

Hi guys.Just did a program that displays all keyboard codes.My problem is that it doesnt work for lower cases letters.I did it this way beacause i also needed to display ctrl,shift ,alt.and i cant read them without GetAsyncKeyState.Can someone show me how to do it for a-z lower cases letters?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stdafx.h"
#include <iostream>
using namespace std;
#include <windows.h>


int main()
{
	int key;

	while (1)
	{
		for (key = 0; key<256; key++) 
		{
			if (GetAsyncKeyState(key) == -32767) 
				cout << char(key) << " = " << key << endl;
		}
	
}
}
 


I do not have any examples of the top of my head, but here, take a look at this and related articles. Since you are using windows.h, you should find it usefull:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646301%28v=vs.85%29.aspx
I don't think letters with different cases are given their own key codes. You may want to check those modifier keys separately in your while loop. If you're not sure what their codes are, here's a table:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx

As this is a WinAPI question, it should have been in Windows Programming. Just for future reference. :)

-Albatross
Topic archived. No new replies allowed.