Click here to Skip to main content
15,867,835 members
Articles / Desktop Programming / MFC
Article

Onscreen Keyboard

Rate me:
Please Sign up or sign in to vote.
4.71/5 (34 votes)
21 Mar 2000 665.2K   16.9K   102   92
An onscreen keyboard for pen computing and touchscreens
  • Download source files - 143 Kb

    Sample Image - OnscreenKeyboard.gif

    I needed a simple onscreen keyboard to interface with a touch / pen based computer that I bought through an online auction. Although Microsoft supplies one with its Pen Extensions 2.0 it only works win Win95 and I wanted to use NT.

    All of the available onscreen keyboards I found were either too expensive, or they were only designed to operate with 3.1 and 9x so (of course) I decided to see if I could make one. Along the way I learned a little about how the keyboard is handled, and the thread keyboard maps.

    Included with this article is a working, but simple, onscreen keyboard. I submitted it mostly as an example of the methods:

    • AttachThreadInput
    • keybd_event
    • VkKeyScan
    • GetKeyState

    This program has one nasty limitation, and that is that it "flashes" since it does not prevent the changing of focus to itself when clicked, and then back to the target window when the keystroke is generated. If someone wants to tackle that one please feel free ;-)

  • License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    QuestionDaniel Pin
    otaku191-Feb-07 22:56
    otaku191-Feb-07 22:56 
    QuestionI have a problem with the address bar Pin
    arrodenas4-Nov-06 10:35
    arrodenas4-Nov-06 10:35 
    AnswerRe: I have a problem with the address bar Pin
    storein19-Dec-06 23:57
    storein19-Dec-06 23:57 
    GeneralRe: I have a problem with the address bar Pin
    arrodenas2-Jan-07 8:33
    arrodenas2-Jan-07 8:33 
    GeneralFixed the ESC key Pin
    cfo5ter5-Sep-06 12:31
    cfo5ter5-Sep-06 12:31 
    GeneralRe: Fixed the ESC key Pin
    storein17-Dec-06 14:58
    storein17-Dec-06 14:58 
    QuestionONSCREEN KEYBOARD Pin
    raeesa4-Sep-06 3:47
    raeesa4-Sep-06 3:47 
    GeneralRe: ONSCREEN KEYBOARD Pin
    Rajesh R Subramanian9-May-07 7:55
    professionalRajesh R Subramanian9-May-07 7:55 
    The code seems pretty straight forward to me. What exactly is that you do not understand?


    "Hmmm, I wonder if this guy knows about the VCF?
    That's what all the cool programmers are using according to Jenna Jameson."
    - Jim Crafton.

    QuestionCan we change initial size? Pin
    peterpecker10-Mar-06 5:43
    peterpecker10-Mar-06 5:43 
    QuestionRe: Can we change initial size? Pin
    gidtitan21-Mar-07 10:06
    gidtitan21-Mar-07 10:06 
    Generala better Onscreen Virtual keyboard Pin
    Ilanbm1-Mar-06 2:11
    Ilanbm1-Mar-06 2:11 
    GeneralRe: a better Onscreen Virtual keyboard - Link Pin
    Ilanbm1-Mar-06 2:12
    Ilanbm1-Mar-06 2:12 
    GeneralRe: a better Onscreen Virtual keyboard - Link Pin
    jmelgaard17-Jan-07 1:57
    jmelgaard17-Jan-07 1:57 
    GeneralTentative Enhancement Pin
    Richard C. Chang20-Dec-05 13:19
    Richard C. Chang20-Dec-05 13:19 
    QuestionRe: Tentative Enhancement Pin
    JY.Ciou5-Mar-06 14:20
    JY.Ciou5-Mar-06 14:20 
    QuestionRe: Tentative Enhancement Pin
    Homero De la Garza5-Aug-07 8:37
    Homero De la Garza5-Aug-07 8:37 
    GeneralRe: Tentative Enhancement Pin
    gidtitan21-Mar-07 10:07
    gidtitan21-Mar-07 10:07 
    QuestionJapanese? Pin
    matsnas6-Dec-05 22:07
    matsnas6-Dec-05 22:07 
    GeneralTimer Pin
    simcon7-Jun-05 23:20
    simcon7-Jun-05 23:20 
    Generalexecute Pin
    simcon9429-May-05 23:58
    simcon9429-May-05 23:58 
    GeneralKill keyboard from another app Pin
    Member 133159416-Feb-05 11:10
    Member 133159416-Feb-05 11:10 
    GeneralRe: Kill keyboard from another app Pin
    Dirk Moshage21-Feb-05 6:26
    Dirk Moshage21-Feb-05 6:26 
    GeneralRe: Kill keyboard from another app Pin
    Member 133159425-Feb-05 6:45
    Member 133159425-Feb-05 6:45 
    GeneralUsing the Windows OSK Pin
    Alex Evans29-Jan-05 18:35
    Alex Evans29-Jan-05 18:35 
    GeneralRe: Using the Windows OSK Pin
    EjayBoy1-Aug-06 12:04
    EjayBoy1-Aug-06 12:04 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.