I am looking for similar solution. How do you handle combination key strokes
""Jeffrey Tan[MSFT]"" wrote:
> Hi Phil,
>
> Based on my understanding, you want to know the actual keypress char in
> Keydown/keyup event.
>
> This is similar as Win32 keyboard messages:
> Message Key or Code
> WM_KEYDOWN Virtual key code for `A' (0x41)
> WM_CHAR Character code for `a' (0x61)
> WM_KEYUP Virtual key code for `A' (0x41)
>
> After WM_KEYDOWN message, Windows use TransplateMessage win32 API to
> translate the Virtual-Key code into character code, with a WM_CHAR message.
> That is why we can not directly get the character code in keydown event,
> because Windows did call TransplateMessage yet.
>
> For this issue, we may use a private char variable to store the character
> key press in KeyPress event, then we can refer it in KeyUp event.
>
> For keydown event, there is not an easy way to translate, but we may use
> KeyEventArgs.KeyCode.ToString() method to get the string representation of
> key stroke, which is the same as the character press for "visible key
> stroke" such as english character and numberic etc.
> But keydown may also get some "invisible key stroke" such as F1~F12, Num
> Lock, Insert, Delete etc.., we may store all the visible characters in a
> string, then use String.IndesOf method to determine if the key stroke in
> keydown is in this string(if in, it is visible key stroke).
>
> =========================================
> Please apply my suggestion above and let me know if it helps resolve your
> problem.
>
> Thank you for your patience and cooperation. If you have any questions or
> concerns, please feel free to post it in the group. I am standing by to be
> of assistance.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! -
www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights.
>