#### Archived

This topic is now archived and is closed to further replies.

# Getting input from 0x60

This topic is 5649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How does I get input from 0x60 , i am trying to get multiple keys, i use MSVC++ 6.0 thnx and sorry about my english hehehe i am brazilian

##### Share on other sites
If I''m right, you want to access directly the "keyboard" port (It''s been long so maybe I''m wrong). This is both possible and impossible. It''s possible when you want to write a driver (but I won''t suggest that and as I''ve never written any, maybe it''s a wrong solution). And it''s impossible under standard windows environment. Use DirectInput instead (a part of DirectX)

##### Share on other sites
Well if you really want to and can read the port, you need a scancode lookup table. You basically use the scancode as an offset into this array of ASCII codes although it is a little more complicated than that. Check out http://www.nondot.org/sabre/os/articles/. It might be .com instead so check both.

##### Share on other sites
You can use GetAsyncKeyState to check for multiple keys being pressed. Check the MSB of the return-value, if it is set, the key is pressed. Example:

    #define IsKeyDown(key) (0x8000 & GetAsyncKeyState(key)) #define IsKeyUp(key) (!IsKeyDown(key)) //Use the macros as follows:if (IsKeyDown(VK_SPACE)){   // Space is currently pressed} if (IsKeyUp(VK_F1)){   // F1 is not pressed}

As someone mentioned above, you can also use DirectInput, though it's a bit more involved.

For further information about GetAsyncKeyState and the VK_-codes it accepts as argument check the MSDN.

[edited by - Dactylos on June 24, 2002 10:06:55 AM]

##### Share on other sites

Take care with Async though, as it won''t matter if your window has the focus or not, your program will still respond to the keypress (unless you idle the frame loop when you window isn''t the focus window).

##### Share on other sites
Thanx a lot guys , before i learn DirectX i'll try Dactylos axample thanx to everyone thx thx thx

Getkeystate is in windows.h ???

[/edit]

[edited by - Homer Simpson on June 24, 2002 11:01:04 AM]

• ### Forum Statistics

• Total Topics
628642
• Total Posts
2983992

• 9
• 10
• 20
• 20
• 13