Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dial Phone from vb ap

Posted on 2001-06-06
8
Medium Priority
?
860 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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

704 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