Seite 1 von 2
(Erledigt) GetAsyncKeyState_(#VK_CONTROL) & 1
Verfasst: 31.12.2017 15:08
von tft
Hallo,
mich packt bald der Wahnsinn .... aber solange ich noch eine Anlaufstelle für Fragen habe, will ich nicht aufgeben.
Es gibt scheinbar Programme, die ein auslesen über oben genannte Funktion blockieren. Gibt es noch eine andere möglichkeit
bei bekanntem Fenster Handle auf Tastentruck zu reagieren.
Gruss TFT
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 31.12.2017 15:11
von tft
Hallo,
Hooks funktionieren bei besagtem Fenster auch nicht .......
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 31.12.2017 15:30
von Imhotheb
Wenn andere Programme auch exzessiv Gebrauch von der Funktion machen kamn es Probleme geben...
MSDN hat geschrieben:Although the least significant bit of the return value indicates whether the key has been pressed since the last query, due to the pre-emptive multitasking nature of Windows, another application can call GetAsyncKeyState and receive the "recently pressed" bit instead of your application.
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 31.12.2017 17:52
von _JON_
Und &1 ist nicht ganz richtig probier mal:
Code: Alles auswählen
If (GetAsyncKeyState_(#VK_LCONTROL) & $8000)
Debug "Pressed Left Ctrl"
EndIf
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 31.12.2017 18:32
von tft
Hallo,
auch so funktioniert es nicht in allen Fenstern. Ich denke ich muss da einen anderen Weg gehen.
Danke für die Zahlreiche Anteilnahme.
Grus TFT
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 31.12.2017 20:00
von Mijikai
Vielleicht ist DirectX schuld -> DirectInput / XInput
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 01.01.2018 01:53
von tft
Hallo,
ja das könnte sein . Es handelt sich dabei immer um Spiele im Fenster Modus wo es nicht funktioniert.
Gibt es da eine Möglichkeit über Direct X an die Tastenanschläge zu kommen?
Gruss TFT
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 01.01.2018 11:29
von ccode_new
Schönes neues Jahr 2018
Also "tft" ist es nicht wirklich sinnvoller, wenn dein Programmfenster (was die Eingaben entgegennimmt) den Fokus nicht verlieren darf und im besten Fall immer oben auf ist (sticky).
Quasi jedem Programm die Erlaubnis zu unterbinden Tastatur-/oder Mausereignisse entgegen zu nehmen, wehrend dein Programm keinen Fokus hat, grenzt fast an Wahnsinn.
Oder darf ein anderes Programm (z.B. DirectX/OpenGL/Vulkan) auch z.B. gleichzeitig auf die Enter-Taste/Pfeil-Taste/etc. reagieren und dein Programm auch. Ist das bei dir eigentlich egal ?
Wenn ja könnte man sicherlich noch eine Lösung finden.
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 01.01.2018 12:18
von Mijikai
tft hat geschrieben:...
Gibt es da eine Möglichkeit über Direct X an die Tastenanschläge zu kommen?
...
Mann kann z.B. das 'IDirectInputDevice' (vTable) hooken...
Oder was mit RawInput versuchen ->
https://msdn.microsoft.com/de-de/librar ... s.85).aspx
There are several advantages to the raw input model:
- An application does not have to detect or open the input device.
- An application gets the data directly from the device, and processes the data for its needs.
- An application can distinguish the source of the input even if it is from the same type of device. For example, two mouse devices.
- An application manages the data traffic by specifying data from a collection of devices or only specific device types.
- HID devices can be used as they become available in the marketplace, without waiting for new message types or an updated OS to have new commands in WM_APPCOMMAND.
Re: GetAsyncKeyState_(#VK_CONTROL) & 1 Funktioniert nicht ?
Verfasst: 01.01.2018 14:59
von tft
Hallo,
@ ccode_new
ich möchte nicht das die Tasten unterbunden werden. Ich möchte das mein Programm. Ob es den Fokus hat oder nicht. Immer auf tasten Druck reagieren
kann. Und weis welche Taste gedrückt wurde. GetAsyncKeyState_() macht da schon genau was ich brauche. Aber bei DX Fenstern wohl scheinbar nicht.