Detect Keyboard Input
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Detect Keyboard Input

  1. #1
    Join Date
    Jun 2011
    Posts
    2

    Detect Keyboard Input

    Hello Guys

    I am new to programming and the demands of my code are fairly simple I think.
    But since I have close to zero experience, I don't know where to start.

    I have one form with say 10 buttons.
    Whenever the form loads, I want it to wait for a key on the keyboard to be presses.
    Lets say any number 0-9

    Depending on which number I pressed,
    It simulates a click on the corresponding button.

    So in short

    1.Form loads
    2.Detect key input
    3.Execute button click depending on key input.

    e.g. --> press button 1 if "1" is pressed..and so on..

    Can someone please help me ?

    Thanks in advance.

  2. #2
    Join Date
    Jun 2011
    Posts
    6

    Re: Detect Keyboard Input

    How much Windows programming do you know? Can you display a form and is it just keyboard input which is new?

    What tools are you using?

  3. #3
    Join Date
    Jun 2011
    Posts
    2

    Re: Detect Keyboard Input

    I have done very basic programming in the past using C, C++, And Visual Basic.
    But all of that programming was also done with the help of forums.
    I just know basics like if-elses, etc.. But I have always managed to achieve what I was hoping for.

    Just imagine 1 form with 10 buttons named 1-10
    And everytime you press a button, a message box pops "You presses button 1".
    The only catch is, I intend to simulate these button clicks by detecting keyboard input
    from 0-9 instead of using the mouse to click on them.

    Any help, direction to posts where this kind of stuff is already done would be appreciated.

    I know for sure that If its the right code, It will be the same code repeating 10 times.
    Not very hard I guess. I just dont know how I would listen for key press , compare its ASCII value
    and show a different message box everytime the key is different.

    Thanks

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center