Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. The best way to get the keystrokes in ASCII form

The best way to get the keystrokes in ASCII form

Scheduled Pinned Locked Moved C / C++ / MFC
json
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    INA_ctive
    wrote on last edited by
    #1

    I'm using Windows API. Usually i use the GetKeyNameText function, but i found that i'm not satisfied with it since it returns all upper case ascii, it return special character such as the enter and space as ascii "Enter" and "Space". Do you have recommendation about more suitable function or maybe a way to solve this (if there isn't any function like that) thank you very much =)

    O V 2 Replies Last reply
    0
    • I INA_ctive

      I'm using Windows API. Usually i use the GetKeyNameText function, but i found that i'm not satisfied with it since it returns all upper case ascii, it return special character such as the enter and space as ascii "Enter" and "Space". Do you have recommendation about more suitable function or maybe a way to solve this (if there isn't any function like that) thank you very much =)

      O Offline
      O Offline
      Owner drawn
      wrote on last edited by
      #2

      Did you try

      int ToAscii(UINT uVirtKey,
      UINT uScanCode,
      PBYTE lpKeyState,
      LPWORD lpChar,
      UINT uFlags
      );

      Jesus Loves You and Me :)

      --Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord

      1 Reply Last reply
      0
      • I INA_ctive

        I'm using Windows API. Usually i use the GetKeyNameText function, but i found that i'm not satisfied with it since it returns all upper case ascii, it return special character such as the enter and space as ascii "Enter" and "Space". Do you have recommendation about more suitable function or maybe a way to solve this (if there isn't any function like that) thank you very much =)

        V Offline
        V Offline
        vishalmore
        wrote on last edited by
        #3

        Have you tried --- "GetAsyncKeyState" ? Cheers, Vishal

        O 1 Reply Last reply
        0
        • V vishalmore

          Have you tried --- "GetAsyncKeyState" ? Cheers, Vishal

          O Offline
          O Offline
          Owner drawn
          wrote on last edited by
          #4

          The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.

          Jesus Loves You and Me :)

          --Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord

          I 1 Reply Last reply
          0
          • O Owner drawn

            The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.

            Jesus Loves You and Me :)

            --Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord

            I Offline
            I Offline
            INA_ctive
            wrote on last edited by
            #5

            thank you, i tried the ToAscii function but got stuck: how can i supply the first and the second parameters? i only have access to wParam and lParam of the messages. thank you.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups