• DirectX - how to get DirectInput keyboard CapsLock state ?

    From R.Wieser@21:1/5 to All on Sun Oct 30 19:02:23 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to R.Wieser on Mon Oct 31 08:43:47 2022
    On Sun, 30 Oct 2022 19:02:23 +0100, R.Wieser wrote:
    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

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Mon Oct 31 07:39:14 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)