Solved

Dial Phone from vb ap

Posted on 2001-06-06
8
801 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 56
Concatenate 2 userform comboboxes to a userform text box 4 56
Run code from text file in vb 1 57
How to measure sizes and angles in scanned images ? 3 55
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…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now