Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dial Phone from vb ap

Posted on 2001-06-06
8
Medium Priority
?
864 Views
Last Modified: 2008-08-13
Hi All
In a vb 5 application, I have a list of phone numbers in a list box.  I would like to click on the number and have it dial that number through my modem.  What project references do I need?   What code do I need?
Thanks in advance.
0
Comment
Question by:fayb
  • 4
  • 3
8 Comments
 
LVL 2

Expert Comment

by:Microsoft
ID: 6161159
this is what you require

just click on the url below and download the zip file.

then open it with your vb editor

you can then take part of this code or add your code to it

good luck
http://www.freevbcode.com/ShowCode.ASP?SearchString=dial%20phone%20number&ID=1305

0
 
LVL 1

Expert Comment

by:svaik
ID: 6161163
Dial Phone Numbers Using MSComm Control: Demo
http://www.freevbcode.com/code/MSCommExample.zip
0
 

Author Comment

by:fayb
ID: 6161209
I get "retained is an invalid key and vb5 won't open the file"
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:fayb
ID: 6161217
Also if I click on just the form I get:
Line 43: Class MSCommLib.MSComm of control MSComm1 was not a loaded control class.
0
 
LVL 2

Expert Comment

by:Microsoft
ID: 6161344
Private Sub CancelButton_Click()    CancelFlag = True    CancelButton.Enabled = FalseEnd Sub

Private Sub Dial(Number$)    Dim DialString$, FromModem$, dummy    DialString$ = "ATDT" + Number$ + ";" + vbCr    MSComm1.CommPort = 2    MSComm1.Settings = "9600,N,8,1"    On Error Resume Next    MSComm1.PortOpen = True

    If Err Then        MsgBox "COM2: Not available. Change the CommPort Property To another port."        Exit Sub    End If    MSComm1.InBufferCount = 0    MSComm1.Output = DialString$

    Do        dummy = DoEvents()

        If MSComm1.InBufferCount Then            FromModem$ = FromModem$ + MSComm1.Input

            If InStr(FromModem$, "OK") Then                                Beep                MsgBox "Please pick up the phone and either press Enter or click OK"                Exit Do            End If        End If        'got help from microsoft


        If CancelFlag Then            CancelFlag = False            Exit Do        End If    Loop    MSComm1.Output = "ATH" + vbCr    MSComm1.PortOpen = FalseEnd Sub

Private Sub DialButton_Click()    Dim Number$, Temp$    DialButton.Enabled = False    QuitButton.Enabled = False    CancelButton.Enabled = True    Number$ = InputBox$("Enter phone number:", Number$)    If Number$ = "" Then Exit Sub    Temp$ = Status    Status = "Dialing - " + Number$    Dial Number$    DialButton.Enabled = True    QuitButton.Enabled = True    CancelButton.Enabled = False    Status = Temp$End Sub

Private Sub Form_Load()    MSComm1.InputLen = 0End Sub

Private Sub MSComm1_OnComm()End Sub

Private Sub QuitButton_Click()    EndEnd Sub
 

try that
0
 
LVL 2

Expert Comment

by:Microsoft
ID: 6161355
oops

i mean

Private Sub CancelButton_Click()  
CancelFlag = True
CancelButton.Enabled = False
End Sub

Private Sub Dial(Number$)
Dim DialString$, FromModem$, dummy
DialString$ = "ATDT" + Number$ + ";" + vbCr
MSComm1.CommPort = 2    
MSComm1.Settings = "9600,N,8,1"
On Error Resume Next
MSComm1.PortOpen = True

If Err Then
MsgBox "COM2: Not available. Change the CommPort Property To another port."        Exit Sub    End If    MSComm1.InBufferCount = 0    MSComm1.Output = DialString$

 Do
 dummy = DoEvents()
 If MSComm1.InBufferCount Then
            FromModem$ = FromModem$ + MSComm1.Input
            If InStr(FromModem$, "OK") Then
            Beep                MsgBox "Please pick up the phone and either press Enter or click OK"  
    Exit Do
    End If      
  End If        


If CancelFlag Then
CancelFlag = False
Exit Do
End If
Loop
MSComm1.Output = "ATH" + vbCr  
MSComm1.PortOpen = False
End Sub

Private Sub DialButton_Click()
Dim Number$, Temp$  
DialButton.Enabled = False
QuitButton.Enabled = False
CancelButton.Enabled = True  
Number$ = InputBox$("Enter phone number:", Number$)
If Number$ = "" Then
Exit Sub  
 Temp$ = Status  
  Status = "Dialing - " + Number$
   Dial Number$
   DialButton.Enabled = True  
 QuitButton.Enabled = True
   CancelButton.Enabled = False  
  Status = Temp$End Sub

Private Sub Form_Load()  
 MSComm1.InputLen = 0
End Sub

Private Sub MSComm1_OnComm()
End Sub

Private Sub QuitButton_Click()    
End
End Sub
 

0
 
LVL 2

Accepted Solution

by:
Microsoft earned 400 total points
ID: 6161361
ARGHHH having trouble cutting and pasteing
sorry try this :-




Private Sub CancelButton_Click()  
CancelFlag = True
CancelButton.Enabled = False
End Sub

Private Sub Dial(Number$)
Dim DialString$, FromModem$, dummy
DialString$ = "ATDT" + Number$ + ";" + vbCr
MSComm1.CommPort = 2    
MSComm1.Settings = "9600,N,8,1"
On Error Resume Next
MSComm1.PortOpen = True

If Err Then
MsgBox "COM2: Not available. Change the CommPort Property To another port."
Exit Sub
End If  
MSComm1.InBufferCount = 0
MSComm1.Output = DialString$

 Do
 dummy = DoEvents()
 If MSComm1.InBufferCount Then
            FromModem$ = FromModem$ + MSComm1.Input
            If InStr(FromModem$, "OK") Then
            Beep                MsgBox "Please pick up the phone and either press Enter or click OK"  
    Exit Do
    End If      
  End If        


If CancelFlag Then
CancelFlag = False
Exit Do
End If
Loop
MSComm1.Output = "ATH" + vbCr  
MSComm1.PortOpen = False
End Sub

Private Sub DialButton_Click()
Dim Number$, Temp$  
DialButton.Enabled = False
QuitButton.Enabled = False
CancelButton.Enabled = True  
Number$ = InputBox$("Enter phone number:", Number$)
If Number$ = "" Then
Exit Sub  
 Temp$ = Status  
  Status = "Dialing - " + Number$
   Dial Number$
   DialButton.Enabled = True  
 QuitButton.Enabled = True
   CancelButton.Enabled = False  
  Status = Temp$End Sub

Private Sub Form_Load()  
 MSComm1.InputLen = 0
End Sub

Private Sub MSComm1_OnComm()
End Sub

Private Sub QuitButton_Click()    
End
End Sub
 

0
 

Author Comment

by:fayb
ID: 6161477
OK, I put the script in a new VB5 form, created the elements, and after I fixed a couple of your cut/paste errors, and I added comm port 3 - It worked.  I think your original suggestion was for vb6.
Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question