How to read headset key?

fuke

New Member
:sign0013:,I not make it clearly: some buttons(keypad) on the headset ,how to use the headset button to control MyApp,so need read the message from headset.
 

eww245

Member
Licensed User
:sign0013:,I not make it clearly: some buttons(keypad) on the headset ,how to use the headset button to control MyApp,so need read the message from headset.

Try with the forms keypress to see if it receives the keycode.

B4X:
Sub Form1_Keypress(key)
   msgbox(key)
End Sub

If that doesn't work try with the door library

B4X:
Sub App_Start
   door.New1(false)
   door.FromControl("Form1")
   door.SetProperty("KeyPreview", true)
   event.New1(door.Value, "KeyDown")
End Sub

Sub event_NewEvent
   door.Value = event.Data
   msgbox(dooor.GetValue("KeyCode"))
End Sub

If it still won't work, an external libray would have to be written with an SDK from the phones manufacturer.
 

fuke

New Member
Thanks eww245 .I did try it ,but it still not work.

I find an external libray "headset.dll" in my PPC,the headset.dll should be the driver for headset,and how can I call it?
 

eww245

Member
Licensed User
Thanks eww245 .I did try it ,but it still not work.

I find an external libray "headset.dll" in my PPC,the headset.dll should be the driver for headset,and how can I call it?

It might be possibe with a keyboard hook.
I'll write a dll and and see if it works
 

eww245

Member
Licensed User
I've been trying to get the keycodes using a Keyboard Hook.
Unfortunately it's not working for me.
It prevents all key presses and, if the keycode is known, will allow a key press.

Sorry, it looks like I can't help.
 
Top