|
-
Sep 28th, 2006, 01:40 AM
#1
Thread Starter
New Member
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.
-
Sep 28th, 2006, 01:45 AM
#2
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:
Select Case KeyAscii
Case 37:
MsgBox "You pressed the left arrow"
Case 38:
MsgBox "You presses the up arrow"
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
-
Sep 28th, 2006, 07:59 AM
#3
Member
Re: ASCII Command
What is the "windows media center remote control", Microsoft Multi Media Control?
-
Sep 28th, 2006, 08:17 AM
#4
Re: ASCII Command
 Originally Posted by Green Africa
What is the "windows media center remote control", Microsoft Multi Media Control?
May Be
-
Sep 28th, 2006, 08:46 AM
#5
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
-
Sep 28th, 2006, 09:37 AM
#6
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:
Private Sub Form_Activate()
Me.KeyPreview = True
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print KeyCode & " in KeyDown"
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Debug.Print KeyAscii & " in KeyPress"
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|