Solved

Dial Phone from vb ap

Posted on 2001-06-06
8
851 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 100 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

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!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month4 days, 5 hours left to enroll

630 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