Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Recording what user types, for chat

  1. #11

    Recording what user types, for chat

    Quote Originally Posted by User137
    Quote Originally Posted by cronodragon
    Take a look at: http://msdn2.microsoft.com/en-us/library/bb174685.aspx

    There is the whole list in order from 0 to 255. Just make you array in such way that it matches those ascii codes, like this:

    const
    AsciiKey : array[0..255] of Char =
    '0', // DIK_0,
    '1', // DIK_1,
    '2', // DIK_2,
    '3', // DIK_3,
    '4', // DIK_4,
    '5', // DIK_5,
    '6', // DIK_6,
    '7', // DIK_7,
    '8', // DIK_8,
    '9', // DIK_9,
    'A', // DIK_A,
    #0, // DIK_ABNT_C1,
    #0, // DIK_ABNT_C2,
    ... etc

    Those with value of #0 don't have ascii code. To convert your codes to Ascii just index the array with the code of which key you are getting a press.
    That is unnecessary since chr(byte) already tells what each ascii number means as a letter.
    But using those DIK_ values, the code for A would be 10, not 65 as it would be required by Chr() which is just making a typecast, not a translation.

  2. #12

    Recording what user types, for chat

    Typecasting would still be unneeded Since it's already been made as variable via Virtual Keycodes
    http://delphi.about.com/od/objectpascalide/l/blvkc.htm

    ie: VK_RETURN, VK_BACK, VK_ESCAPE... ord('a') would numerize key 'a'.

  3. #13

    Recording what user types, for chat

    Handle WM_CHAR message to get characters which user types taking in account current keyboard layout, caps lock status etc.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •