GetKeyboardState() problems/usage

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(68) => 1 or something
of the sort… 68 representing “D” of course in ascii.

Any ideas?

Thanks,

  • Mac