Dec 22, 2014, 12:10 am

News:

IT Acumens Proudly Presents "Gin Gly": Sms Backup / Contacts Backup / Sms Grouping Website Used by Members 85,000 - SMS Backed up 6,66,400 - Contacts Stored  28,350. For 5 Years !!


Making a Phone Call in VB.NET

Started by thiruvasagamani, May 23, 2009, 07:40 pm

previous topic - next topic
Go Down

thiruvasagamani

Making a Phone Call in VB.NET

Our code for MakeCall in VB.NET ports with few major modifications from the C# code detailed above. We use IntPtr variables to hold value for most of our functionality. One difference is that in the forward declaration of MakeCall, we specify that the PhoneMakeCallInfo structure instance will be passed in as a reference.
Copy Code

Code: [Select]
    <System.Runtime.InteropServices.DllImport("phone.dll")> _
    Private Shared Function PhoneMakeCall(ByRef ppmci As
      PhoneMakeCallInfo) As IntPtr
    End Function


We process the PhoneMakeCallInfo structure almost identically to as before. We break the PhoneNumber string into a character array then write to memory using iPhoneNumber as a memory alignment pointer.
Copy Code

Code: [Select]
PhoneNumber.Insert(PhoneNumber.Length, " ")
Dim cPhoneNumber() As Char = PhoneNumber.ToCharArray()
Dim pAddr() As Char = cPhoneNumber

Dim info As PhoneMakeCallInfo = New PhoneMakeCallInfo
info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info)
Dim iPhoneNumber As IntPtr = Marshal.AllocHLocal(cPhoneNumber.Length)
        System.Runtime.InteropServices.Marshal.Copy(cPhoneNumber, 0,
          iPhoneNumber, cPhoneNumber.Length)
info.pszDestAddress = iPhoneNumber


After we point the pszDestAddress member to this memory space and set the confirm before dial option, we pass the structure instance into PhoneMakeCall.
Copy Code

Code: [Select]
If PromptBeforeCall Then
   info.dwFlags = PMCF_PROMPTBEFORECALLING
Else
   info.dwFlags = PMCF_DEFAULT
End If
   res = PhoneMakeCall(info)


Source : MSDN
Thiruvasakamani Karnan


Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview