Results 1 to 6 of 6

Thread: Capture the hex code from keyboard input?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    Capture the hex code from keyboard input?

    Hello,

    How would I write a small app that would capture the hex input from a character entered on the keyboard. Basically, I am trying to figure out the ASCII hex code of another language. I have add the other language in control panel and am able to use the keyboard to type in that language, but I need to know the ASCII hex characters so that I can use them in another program.

    Thanks!

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Maybe !
    VB Code:
    1. Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As
    2. System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
    3.         MessageBox.Show(Hex(e.KeyValue).ToString)
    4.     End Sub

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    Doesn't seem to work exactly pirate. It does display a hex code, but some of them do not match the ASCII table. For example, the ASCII table says that the " + " symbol is 2B and the code above says it is BB.

    What do yo think?

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    try this in the keypress event ...
    VB Code:
    1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    2.         MessageBox.Show(Convert.ToInt32(e.KeyChar).ToString("X")) '/// specify X to convert to Hex
    3.     End Sub
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  5. #5
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    for more info on the ToString method and what it can do ( apart from the standard tostring ) check this msdn article ... Enum.Format Method
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    Thanks for the info and the tip!

Posting Permissions

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



Click Here to Expand Forum to Full Width