Your dialling routine would be like this:
Sub DialPhone(strDial As String) 'Mobile Phone Number
On Error GoTo HandleErr '*******************
Dim varDialWait As Variant
Dim varStart As Variant
Dim lThreadId As Long
Dim lProcessId As Long
Dim ret As Long
Dim strDial As String
Dim lngRetVal As Long
Static blnDialing As Boolean 'Prevent Re-Entry Into Sub While Dialing
Dim strMsg As String
Dim varReturn As Long
Dim lngX As Long
Dim AppCaption As String
Dim hwnd As Long
DoEvents
blnDialing = False
If blnDialing Then Exit Sub
lngRetVal = tapiRequestMakeCall(Trim$(strDial), "", "", "") 'Make call to Number Through Dialer.exe
If lngRetVal = 0 Then blnDialing = True 'Exit sub on tapiRequestMakeCall Fail
Call TestPlayWavFile ' Play Dial Sound Message
For lngX = 1 To 10 ' Number of Loop Times For Sleep
DoEvents
Sleep 1000 ' Sleep 1 Second
Next lngX
'hwnd = FindWindow(vbNullString, AppCaption)
hwnd = FindWindow(vbNullString, "Call Status")
If hwnd <> 0 Then Call SendMessage(hwnd, WM_CLOSE, 0&, 0&)
hwnd = FindWindow(vbNullString, "Phone Dialer")
If hwnd <> 0 Then PostMessage hwnd, WM_CLOSE, 0&, 0&
hwnd = FindWindow(vbNullString, "Dialer")
If hwnd <> 0 Then
PostMessage hwnd, WM_KEYDOWN, VK_RETURN, 0
PostMessage hwnd, WM_KEYUP, VK_RETURN, 0
End If
Exit Sub
HandleErr:
Select Case Err.Number
Case 94 'Invalid Use of Null - if double-click on blank, open dialer
MsgBox "here" 'Call Shell("c:\windows\dialer.exe", vbNormalFocus)
Exit Sub
Case Else
'modHandler.LogErr ("frm0Telephone"),("Telephone_Numbers_DblClick" )
End Select
'Resume Exit_Here
End Sub
and you would call it from each control using:
DialPhone Combobox_List_Search.TextBox10
for example.
Bookmarks