Discussion:
DirectX - how to get DirectInput keyboard CapsLock state ?
(too old to reply)
R.Wieser
2022-10-30 18:02:23 UTC
Permalink
Hello all,

I'm doing some DirectX using DirectInput, which works nicely. But I would
like to be able to get the current state of the, for instance, CapsLock key.

I came as far as the DIOBJECTDATAFORMAT struct and its flags
(DIDFT_PSHBUTTON, DIDFT_TGLBUTTON and DIDFT_BUTTON), but have not been able
to figure out how to use them to retrieve (or create!) a toggle key.

Hence my question :

1) Is it actually possible to access (or create) a toggle key thru
DirectX-es DirectInput mechanism ?

2) If so, how do I go about it ?

Mind you, I already got some code to create a toggle from a non-toggeling
key. Thats not what I'm asking for. :-)

Regards,
Rudy Wieser
JJ
2022-10-31 01:43:47 UTC
Permalink
Post by R.Wieser
Hello all,
I'm doing some DirectX using DirectInput, which works nicely. But I would
like to be able to get the current state of the, for instance, CapsLock key.
I came as far as the DIOBJECTDATAFORMAT struct and its flags
(DIDFT_PSHBUTTON, DIDFT_TGLBUTTON and DIDFT_BUTTON), but have not been able
to figure out how to use them to retrieve (or create!) a toggle key.
1) Is it actually possible to access (or create) a toggle key thru
DirectX-es DirectInput mechanism ?
2) If so, how do I go about it ?
Mind you, I already got some code to create a toggle from a non-toggeling
key. Thats not what I'm asking for. :-)
Regards,
Rudy Wieser
Haven't actually tested it, but isn't DInput's `GetDeviceState()` return the
same data as WinAPI's `GetKeyboardState()`? i.e. MSB = pressed, LSB =
toggle.
R.Wieser
2022-10-31 06:39:14 UTC
Permalink
JJ,
Post by JJ
Post by R.Wieser
1) Is it actually possible to access (or create) a toggle key thru
DirectX-es DirectInput mechanism ?
2) If so, how do I go about it ?
...
Post by JJ
Haven't actually tested it, but isn't DInput's `GetDeviceState()` return
the same data as WinAPI's `GetKeyboardState()`? i.e. MSB = pressed, LSB =
toggle.
Thats what I assumed too. But as I did not get the expected result I
displayed the involved byte. Alas, no change of any bit other than the MSB.

Double checked it with DIK_SCROLL and DIK_NUMLOCK and got the same result.

Hence my idea that I should perhaps change something in the
DIOBJECTDATAFORMAT declaration of the involved key(s).

Regards,
Rudy Wieser

Loading...