IDirectInputDevice8::GetDeviceStateKeyboard
or IDirectInputDevice8::GetDeviceState
. That''s the wrong function to be using, you should use IDirectInputDevice8::GetDeviceData
. Here''s a quick sample: DIDEVICEOBJECTDATA keyState[64]; unsigned long numKeys = 64; m_Keyboard->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), keyState, &numKeys, 0 ); for( int i = 0; i < (signed)numKeys; i++ ) { if( keyState[i].dwData != 0 ) // key was pressed { char ascii = scan2asc( keyState[i].dwOfs ); // now append ascii to your string... } }
codeka.com - Just click it.