Click here to Skip to main content
15,881,600 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 666.1K   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

     
    GeneralRe: Can't Compile Pin
    User 10706397-Dec-04 1:47
    User 10706397-Dec-04 1:47 
    Generalhelp Pin
    davidorff16-Sep-04 22:37
    davidorff16-Sep-04 22:37 
    GeneralRe: help Pin
    Member 153990417-Apr-05 6:29
    Member 153990417-Apr-05 6:29 
    GeneralRe: help Pin
    cfo5ter5-Sep-06 12:24
    cfo5ter5-Sep-06 12:24 
    Generalenquiry Pin
    davidorff12-Sep-04 20:46
    davidorff12-Sep-04 20:46 
    GeneralRe: enquiry Pin
    Dirk Moshage14-Sep-04 5:20
    Dirk Moshage14-Sep-04 5:20 
    GeneralRe: enquiry Pin
    davidorff14-Sep-04 21:15
    davidorff14-Sep-04 21:15 
    GeneralI want to use on-screen keyboard for touch screen Pin
    misaaeshow29-Aug-04 23:56
    misaaeshow29-Aug-04 23:56 
    Generalvery slow when sending textt to MSN messenger text box Pin
    Anonymous11-Aug-04 19:59
    Anonymous11-Aug-04 19:59 
    GeneralRe: very slow when sending textt to MSN messenger text box Pin
    Anonymous28-Aug-04 11:22
    Anonymous28-Aug-04 11:22 
    GeneralESC get error! Pin
    Junee6-Apr-04 17:05
    Junee6-Apr-04 17:05 
    GeneralRe: ESC get error! Pin
    Jinsuk Kim5-Oct-04 23:17
    Jinsuk Kim5-Oct-04 23:17 
    GeneralSuperficial Question.... Pin
    TeddyGraham6-Mar-04 14:51
    TeddyGraham6-Mar-04 14:51 
    GeneralAltGr Pin
    simcon24-Feb-04 20:28
    simcon24-Feb-04 20:28 
    GeneralRe: AltGr Pin
    altarribage7-Dec-05 4:17
    altarribage7-Dec-05 4:17 
    GeneralFocus Problem and Flashing Pin
    Dirk Moshage20-Jan-04 12:59
    Dirk Moshage20-Jan-04 12:59 
    GeneralRe: Focus Problem and Flashing Pin
    teloglu21-Mar-05 3:42
    teloglu21-Mar-05 3:42 
    GeneralGetting the keyboard to interact with windows editors Pin
    hynespm15-Oct-03 8:28
    hynespm15-Oct-03 8:28 
    GeneralProblem with inputbox Pin
    AlexMateman9-Oct-03 22:54
    AlexMateman9-Oct-03 22:54 
    GeneralRe: Problem with inputbox Pin
    Kadji23-Sep-04 22:02
    Kadji23-Sep-04 22:02 
    QuestionDoes this code work under Win98/ME? Pin
    Oitz25-Mar-03 8:09
    Oitz25-Mar-03 8:09 
    AnswerRe: Does this code work under Win98/ME? Pin
    J. Dunlap17-Jul-03 19:21
    J. Dunlap17-Jul-03 19:21 
    GeneralFlashing problem still unsolved!! Pin
    Mahbub7321-Jan-03 9:02
    Mahbub7321-Jan-03 9:02 
    QuestionCan't fix the Bug with IE address bar? Pin
    Wang Hai26-Sep-02 17:41
    Wang Hai26-Sep-02 17:41 
    GeneralNice Work Pin
    Brian Delahunty21-Sep-02 7:16
    Brian Delahunty21-Sep-02 7:16 

    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.