Take an incomming call on a smartphone

Hi,

I'm trying to make a program in VB using SmartPhone functions.

For instance, I succed to dial a call with PhoneMakeCall function :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/APISP/html/sp_phone_phonemakecall.asp

I'd like to know if it's possible to take an incomming call, I can't find anything about that on MSDN..

Does someone could say me if it's posible, and how do that.

thanks

[712 byte] By [jjm] at [2008-1-21]
# 1
All you can do is call the raw TAPI API, (lineanswer), but we do not recommend this, because it doesn't play well with the Windows Mobile phone application.

Alternatively, if you know the phone is ringing, you could fake a press of the talk button via keybd_event(VK_TTALK).

- Larry Lieberman [Microsoft]
Mobile Developer Experience Team

LarryLieberman at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 2
Ok, thanks a lot, I'll try this alternative solution.
thanks for your answer.

regards

jjm at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 3

I'd like try your solution, but I don't know whitch value to give to "VK_TTALK" constant.

So I've try to use this method to shut the smartphone for example, here is my code :
Declare Sub keybd_event Lib "coredll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlag As Long, ByVal dwExtraInfo As Long)

Const VK_OFF = &HDF

Call keybd_event(VK_OFF, 0, 0, 0)

-

and the program stop because of a "System.NotSupportedException", I think, it would be the same thing with VK_TTALK constant...

Could you please explain me witch value to give to VK_TTALK, and why there is this exception.

Thanks in advance.

regards

jjm at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 4

I've found the key code for VK_TTALK, it's 114, and 115 to stop the call, 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 bVk 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 at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 5
Sorry for my failure to specify; VK_TTALK is only available on PPC-phone, not Smartphone.
LarryLieberman at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 6
It's ok, it was a very good idea to simulate a keypress, my programme is now running :


Const KEYEVENTF_KEYUP = &H2
Const KEYEVENTF_KEYDOWN = &H0

#Region " Pickup a call "

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 " Hang up a call"

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


jjm at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 7
Sorry, i forgot the import..
Here is the good one :



<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


jjm at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 8
Glad to here you worked things out.
LarryLieberman at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...
# 9
what's the problem ?
jjm at 2007-8-21 > top of Msdn Tech,Smart Device Development,.NET Compact Framework...