Tech Note 14: Phone ControlApril 13, 2009© NSB Corporation. All rights reserved. |
Using the phone control, it is possible to initiate cellular phone calls and to review the incoming and outgoing call log.
In order to use the the NSBasic Phone control in your program, use the following command:
AddObject "NSBasic.Phone.1", "phone", 0, 0, 0, 0
The Phone Control must be installed and registered on your device. See Tech Note 01 for more information on how to load this module onto your system. The standard NS Basic installers do not register the control automatically: before you use it for the first time, execute the command
ShellExecute("open","regsvrce","NSBPhone.ocx"
Method |
Parameters | Description |
|
PhoneNumber (string) CalledParty (string) PromptBefore (boolean |
Places a call to the phone number and party, with the option to delay the call while prompting the user |
|
None |
Returns the total number of entries in the call log. If the call log is empty, an very large number is returned. |
|
EntryNumber (integer, 1 through CallLogCount) |
This points the control to a specific log entry. Use the properties listed below to get information about a given entry. |
All of the properties in the NSBPhone control are read-only and are used to access members of a call log entry. Before the properties can be retrieved, a successful call to CallLogEntry must be made. The syntax is
value = object.property
Property |
Description |
|
Caller ID information is:
|
|
Did the outgoing call connect?
|
|
The time the call ended. |
|
How was the call ended?
|
|
Incoming/Outgoing/Missed:
|
|
The name associated with the call. |
|
The name type associated with the call:
|
|
The file name of the Notes file associated with the call (if a Notes file exists). |
|
The phone number associated with the call. |
|
Was the call outgoing?
|
|
Was the call made while roaming?
|
CLEStart |
The time the call started. |
'NSBPhone example ' 'Add the NSBasic Phone control AddObject "NSBasic.Phone.1", "phone", 0,0,0,0 'Add a labeled text box for phone number entry AddObject "Label", "lblNumber", 5,5,110,16 lblNumber.Caption = "Phone Number:" lblNumber.BackColor = Output.BackColor AddObject "TextBox", "txtNumber", 5,25,160,20 'Add a labeled text box for callee name entry AddObject "Label", "lblName", 5,50,110,16 lblName.Caption = "Name:" lblName.BackColor = Output.BackColor AddObject "TextBox", "txtName", 5,70,160,20 'Add a button to initiate the call AddObject "CommandButton", "btnDial", 170,25,65,65 btnDial.Text = "Dial" 'Use a grid object to represent some info from the call log AddObject "Grid", "grdLog", 5,95,230,170 grdLog.Redraw = False grdLog.Rows = phone.CallLogCount grdLog.Cols = 5 grdLog.ColWidth(0) = 180 grdLog.ColWidth(1) = 1650 grdLog.ColWidth(2) = 1650 grdLog.ColWidth(3) = 1200 grdLog.ColWidth(4) = 1500 For i = 1 To phone.CallLogCount phone.CallLogEntry i grdLog.TextMatrix(i-1, 0) = phone.CLEIOM grdLog.TextMatrix(i-1, 1) = phone.CLEStart grdLog.TextMatrix(i-1, 2) = phone.CLEEnd grdLog.TextMatrix(i-1, 3) = phone.CLENumber grdLog.TextMatrix(i-1, 4) = phone.CLEName Next grdLog.Redraw = True 'When the button is tapped, make the call, but don't prompt before dialing Sub btnDial_Click phone.MakeCall txtNumber.Text, txtName.Text, False End Sub