Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

DirectX - how to get DirectInput keyboard CapsLock state ?

瀏覽次數:22 次
跳到第一則未讀訊息

R.Wieser

未讀,
2022年10月30日 下午2:02:362022/10/30
收件者:
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月30日 晚上9:43:502022/10/30
收件者:
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日 凌晨2:39:472022/10/31
收件者:
JJ,

>> 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 ?
...
> 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


0 則新訊息