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



Answer this question

Take an incomming call on a smartphone

  • SQLMonger66

    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


     


  • NathanLiu

    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

     

     



  • Hooray_for_Boobies

    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


  • Arthg2000

    what's the problem
  • phita

    Ok, thanks a lot, I'll try this alternative solution.
    thanks for your answer.

    regards

  • Erik Arfeuille

    Sorry for my failure to specify; VK_TTALK is only available on PPC-phone, not Smartphone.
  • blade00007

    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

  • mrfantasy999

    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


  • Ratzu

    Glad to here you worked things out.
  • Take an incomming call on a smartphone