Results 1 to 2 of 2

Thread: MSCOMM HELP QUICKLY!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Posts
    2

    Exclamation

    Does anyone have a program (that works) that just dials the phone number? If you do please e-mail it to me

    Thank You
    Alex Cameron

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Thumbs up

    Hope this make sense to you.

    Code:
    Option Explicit
    Private ACK As Boolean
    Private str As String
    Private Buff As String
    
    Private Sub Form_Load()
    With MSComm1
        If Not .PortOpen Then
            'Initialize the Comm
            .CommPort = 1
            .Settings = "9600,n,8,1"
            .InputLen = 1
            
            'Open the Comm port
            .PortOpen = True
                    
            'Reset the Modem
            ACK = False
            .Output = "ATZ" & vbCr
            
            'Wait for the "OK" from modem
            Do While Not ACK
                DoEvents
            Loop
    
            'Reset the flag
            ACK = False
    
            'Dial the phone number
            .Output = "ATDT 123456789" & vbCr
            
            'Wait for the "OK" from modem
            Do While Not ACK
                DoEvents
            Loop
            
            MsgBox "Wait for the receive party to pickup the call."
        Else
            MsgBox "Comport not available."
        End If
    End With
    End Sub
    
    Private Sub MSComm1_OnComm()
    Select Case CommEvent
    Case comEvReceive
        ProcessData
    End Select
    End Sub
    
    Private Sub ProcessData()
    str = str & MSComm1.Input
    Do While str <> ""
        'Search for the "OK" from Modem
        If InStr(1, Buff, "OK", vbTextCompare) <> 0 Then
            Buff = ""
            ACK = True
        End If
        
        Buff = Mid(str, 1, 1)
        str = Mid(str, 1)
        DoEvents
    Loop
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width