Search code examples
delphikeycodepostmessage

Virtual-key codes of parentheses brackets


I am needing to PostMessage(); a pair of parentheses "( )" but I cannot seem to find their virtual-keycodes anywhere.

I've tried to ord(KeyInpunt) and it returns 40/41 yet when I try to PostMessage those values nothing happens.

I have also tried a work around of sending SHIFT + 9 / 0 without any success.

              PostMessage(Handlea, WM_KEYDOWN, VK_SHIFT, 0); // Shift
                           sleep(10);
              PostMessage(Handlea, WM_KEYDOWN, 48, 0);
                           sleep(10);
              PostMessage(Handlea, WM_KEYUP, VK_SHIFT, 0);  //Shift   

Solution

  • The value for KeyEvent.wVirtualKeyCode and KeyEvent.UnicodeChar are:

    • ( = 53 (40)
    • ) = 219 (41)
    • [ = 221 (91)
    • ] = 186 (93)
    • { = 57 (123)
    • } = 48 (1235)