Results 1 to 6 of 6

Thread: ASCII Command

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    2

    Question ASCII Command

    hello...

    just wondering if you are able to find out what key you pressed on the windows media center remote control..?

    also how do you write a code if a key is pressed making it display a messagebox with the key you pressed..

    Eg. if i press the 'Left' arrow key making it say 'you presses: Left arrow key'

    any ideas.. vbkeyLeft don't work when i use that as the ascii key is there any others?

    Thanks.

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: ASCII Command

    There are no string constants available for a key. You will have to manually do it...for example:

    On the keyPress event of your form, put something like this:
    VB Code:
    1. Select Case KeyAscii
    2. Case 37:
    3. MsgBox "You pressed the left arrow"
    4. Case 38:
    5. MsgBox "You presses the up arrow"
    6. End Select
    Etc..

    As for the key pressed on the media center remote control, I'm not exactly sure if you mean an actual object which can be used on forms, or that you mean the media center as a stand-alone application. If the latter, you will need to setup a global keyboard hook and check the currently active windows Title.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    Member
    Join Date
    Sep 2006
    Posts
    40

    Re: ASCII Command

    What is the "windows media center remote control", Microsoft Multi Media Control?

  4. #4
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Lightbulb Re: ASCII Command

    Quote Originally Posted by Green Africa
    What is the "windows media center remote control", Microsoft Multi Media Control?
    May Be

  5. #5
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: ASCII Command

    Ah. If thats the case, you'd have to find some technical documents on the remote itself. If it has buttons similar to a keyboard, the window messages sent to the application being run on Media Center would no doubt be the same.

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: ASCII Command

    If the remote is a wedge (the driver simulates a keyboard), just write a short piece of code to see which keys produce what codes:
    VB Code:
    1. Private Sub Form_Activate()
    2. Me.KeyPreview = True
    3. End Sub
    4.  
    5. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    6. Debug.Print KeyCode & " in KeyDown"
    7. End Sub
    8.  
    9. Private Sub Form_KeyPress(KeyAscii As Integer)
    10. Debug.Print KeyAscii & " in KeyPress"
    11. End Sub
    Run the program, press keys and watch the Immediate window.

    If the remorte isn't a wedge, you'll have to get the specs on the remote to see how to read the button presses, then do pretty much the same thing - debug.print the inputs you get.

    BTW, arrow keys, Pg (up and down) keys, etc. (non-printing keys) don't trigger the KeyPress event since they don't produce ASCII codes, they trigger the KeyDown event and produce keycodes.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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