Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > GetKeyboardState() problems/usage

Reply
Thread Tools

GetKeyboardState() problems/usage

 
 
Michael Linfield
Guest
Posts: n/a
 
      07-09-2009
What seems to be the correct means of using this function?

getState = Win32API.new('user32','GetKeyboardState',['P'],'N')

byteGrid = 0.chr * 256 #for the 256 virtual keycodes

now, using getState.call(byteGrid) changes some of the /000's to /001's
respectively.

However, how might one call back what virtual codes (keys) were
activated?
It'd be nice to have the functionality of getState(6 => 1 or something
of the sort... 68 representing "D" of course in ascii.

Any ideas?

Thanks,

- Mac
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments