Thanks!
Regards
-János
Ideally you should do any processing that needs this information in
OnKeyPress, not in response to a WM_KEYDOWN message.
{: Obtain the character that will result from the virtual key
passed in.
@param vkey is the virtual key code, e.g. Key parameter of an
OnKeyDown handler.
@returns the character or '' if the key does not result in a
character. On rare occasions the function may return two
characters, e.g. if an accent key is pressed followed by
another character that does not have an accented version. }
Function GetCharFromVKey( vkey: word ): String;
var
keystate: TKeyboardState;
retcode: Integer;
begin
Win32Check( GetKeyboardState( keystate ));
SetLength( Result, 2 );
retcode := ToAscii( vkey,
MapVirtualKey( vkey, 0 ),
keystate,
@Result[1],
0 );
Case retcode Of
0: Result := ''; // no character
1: SetLength(Result,1);
2: ;
Else
Result := ''; // retcode < 0 indicates a dead key
End;
end;
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: Till Feb.2001 i will only visit the groups on weekends, so be
patient if i don't reply immediately.