Scan Keyboard...

Just starting out? Need help? Post your questions and find answers here.
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Scan Keyboard...

Post by Skipsy »

Hello,

Sounds stupid but I can't find a (nice, clean, smart...) way for scanning
the whole keyboard.
I just need to know which key is pressed... as an window event.

For now I scan values 1 to 255 in a loop but it is a very empirical
way :oops:

Any :idea:

Thks
Beware of the man who has the solution before he understands the problem...
tony
User
User
Posts: 26
Joined: Thu May 01, 2003 1:35 am
Location: California
Contact:

Post by tony »

Never tried it before, but isn't ExamineKeyboard() designed for that?

Just a quick tought
User avatar
aszid
Enthusiast
Enthusiast
Posts: 162
Joined: Thu May 01, 2003 8:38 pm
Location: California, USA
Contact:

Post by aszid »

i believe examinekeyboard() requires you to be in 3d mode. i think it relies on the directX stuffs.... i could be wrong though... but the mouse commands are like that.
--Aszid--

Making crazy people sane, starting tomorrow.
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

Download the API-Guide from www.allapi.net, and have a look at the keyboard specific stuff there.
Off the top of my head, there`s a command called GetKeyBoardState, and it fills a 256 byte buffer with the state of each key
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post by Skipsy »

Well... GetKeyBoardState fills a buffer with the state of each virtual
key.
It could help but I will also to scan the whole buffer.

I have spent a while looking for an API just returning the keycode stroke
or its ascii value. I fell it does not exist... strange

I 'll find another way,
Thks.
ww
Beware of the man who has the solution before he understands the problem...
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

DOH..I just re-read the original question and saw the bit about window event.

Simple, set up a callback function for your window, and scan the messages for keyups and keydowns..

It only works when your window is active though.
Post Reply