kurotsuke
2005-01-01 22:08:48 UTC
Hi,
I'm trying to use the GetKeyName API to get the name of certain keys
(in the system language). For example the names of SHIFT and RETURN
keys as well as the names of same special characters.
I tried to call the API GetKeyName passing the KeyCode of the KeyUP
event but got no result
scancode = (uint) e.KeyCode;
StringBuilder sb= new StringBuilder(260);
int ret=GetKeyNameText(scancode,sb,20);
[DllImport("user32.dll")]
static extern int GetKeyNameText(uint lParam, [Out] StringBuilder
lpString, int nSize);
Sometimes the APi return 0 and sometimes it returns the name of
another character.
Can somebody post an example on how to use it? I could not find
anything worthwhile around.
Thanks.
I'm trying to use the GetKeyName API to get the name of certain keys
(in the system language). For example the names of SHIFT and RETURN
keys as well as the names of same special characters.
I tried to call the API GetKeyName passing the KeyCode of the KeyUP
event but got no result
scancode = (uint) e.KeyCode;
StringBuilder sb= new StringBuilder(260);
int ret=GetKeyNameText(scancode,sb,20);
[DllImport("user32.dll")]
static extern int GetKeyNameText(uint lParam, [Out] StringBuilder
lpString, int nSize);
Sometimes the APi return 0 and sometimes it returns the name of
another character.
Can somebody post an example on how to use it? I could not find
anything worthwhile around.
Thanks.