0

I want to assign tasks and functions to the additional keys of my keyboard (e.g. Mute,VolumeChange, Browser,...). Now, I do know that DirectInput implements a full list of those keys like DIK_MUTE (msdn link). Unluckily, none of the keys are assigned to those values and obviously every key pressed is recognized as No. 128 by DirectInput.

But Windows seems to have no problem distincting between those keys as some of them are functional and for instance open applications. Is there a way to tweak this issues with or without DirectInput so that i can detect those keys also in fullscreen DX/OpenGL applications?

IDirectInputDevice8* device;
BYTE arrKey[256] = {0};

if FAILED(device->GetDeviceState(sizeof(BYTE)*256,arrKey))
    return false;

BYTE byKey = ReportPressedKey(arrKey, sizeof(BYTE*)*256);
// byKey = 128 (DIK_MUTE, DIK_VOLUMEUP,DIK_NEXTTRACK,...)
BeschBesch
  • 373
  • 2
  • 11
  • You shouldn't be using DirectInput for keyboard input in the first place. http://msdn.microsoft.com/en-us/library/windows/desktop/ee416842(v=vs.85).aspx – chris May 20 '13 at 21:21
  • at first i didn't but then i realized that even hotkeys are blocked by any fullscreen DirectX application. DirectInput was just another idea. Are the better alternatives? My application runs as tray in the background with no active window. – BeschBesch May 20 '13 at 21:39
  • Perhaps a hook if `RegisterHotKey` doesn't work? – chris May 20 '13 at 21:45
  • Actually a nice idea, as the virtual key codes are correct. But nonetheless any game or other DX application blocks it. I think I'll try to dig deeper by retrieving raw input. – BeschBesch May 21 '13 at 09:11
  • Ok, RawInput did the trick. I use `RegisterRawInputDevice` and `GetRawInputData` now to get all keyboard actions from hotkeys, app keys and the rest of course. – BeschBesch May 21 '13 at 11:08

0 Answers0