Simulate a keypress on the phonecallkey of a smartphone

jjm

Member
Joined
Apr 28, 2005
Messages
5
Programming Experience
3-5
Hi,



I'd like to simulate a keypress on the phonecall key of a smartphone.

I've found the keycode of this key which is 114.

So i use keybd_event method, but there is always a "notSupportdExeption"

could you please explain me why...

Here is my code :

------------------------------------------------------------------------

Declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal **k As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)



Public Shared Sub Decrocher()
keybd_event(114, 0, 0, 0)
keybd_event(114, 0, 2, 0)
End Sub

-----------------------------------------------------------------------------

Thanks in advance
 

jjm

Member
Joined
Apr 28, 2005
Messages
5
Programming Experience
3-5
this code is ok :
----------------------------------------------
Const KEYEVENTF_KEYUP = &H2
Const KEYEVENTF_KEYDOWN = &H0

<DllImport("coredll.dll", CharSet:=CharSet.Unicode)> _
Public Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
End Sub

#Region " Décrocher un Appel "

'méthode utilisée pour décrocher un appel entrant
Public Shared Sub Decrocher()

'appui sur la touche appel
keybd_event(114, 0, KEYEVENTF_KEYDOWN, 0)
'relache la touche appel
keybd_event(114, 0, KEYEVENTF_KEYUP, 0)
End Sub

#End Region
#Region " Raccrocher un appel"

'méthode utilisée pour raccrocher un appel
Public Shared Sub Racrocher()
'appui sur la touche raccrocher
keybd_event(115, 0, KEYEVENTF_KEYDOWN, 0)
'relache la touche raccrocher
keybd_event(115, 0, KEYEVENTF_KEYUP, 0)
End Sub

------------------------------------------------------------------------------------
 
Top Bottom