Solved

VB4 and Modems

Posted on 1997-04-23
5
248 Views
Last Modified: 2006-11-17
I have VB4 the standard edition.  Is it possible for me to send modem commands to the serial port from VB?  And if for some reason another program is using the port can I shut down that program and then restart it?
0
Comment
Question by:Xeno
[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
5 Comments
 

Expert Comment

by:pdetagyos
ID: 1425618
Yes, it is possible.  And you can hang up the modem if another program is using it, but that may not be too friendly.  

Look up information on the RAS API.  There are also several third-party controls and libraries that allow you to simplify serial connections.
0
 
LVL 2

Expert Comment

by:weekee
ID: 1425619
Actually to do serial communication, there is a control known as communication control. It allow you to set com port baud rate and rrecive from modem or output to modem. THe ouput can be in terms oof AT commands too. The help file has the neccessary information and examples.
0
 
LVL 1

Expert Comment

by:advapp
ID: 1425620
You rejected both of the previous answers; could you explain what you are looking for?  Are you looking for sample code?
0
 

Author Comment

by:Xeno
ID: 1425621
Well let see... I had VB 4.0 the standard edition...and it appears not to support the MScomm stuff...I just now purchased VB5.0 upgrade and I am sorting through it... Hmmm.. a code sample would be great.
0
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 100 total points
ID: 1425622
MSComm does not come with the standard version on VB, only the professional.  Don't know why...Some Code?  THis is from the Dialer project in VB 4.0/16bit samples:Private Sub Dial(Number$)
    Dim DialString$, FromModem$, dummy

    ' AT is the Hayes compatible ATTENTION command and is required to send commands to the modem.
    ' DT means "Dial Tone." The Dial command uses touch tones, as opposed to pulse (DP = Dial Pulse).
    ' PhoneNumbers$(Index) is the phone number being dialed.
    ' A semicolon tells the modem to return to command mode after dialing (important).
    ' A carriage return, Chr$(13), is required when sending commands to the modem.
    DialString$ = "ATDT" + Number$ + ";" + Chr$(13)

    ' Communications port settings.
    Comm1.Settings = "300,N,8,1"
   
    ' Open the communications port.
    On Error Resume Next
    Comm1.PortOpen = True
    If Err Then
       MsgBox "COM1: not available. Change the CommPort property to another port."
       Exit Sub
    End If
   
    ' Flush the input buffer.
    Comm1.InBufferCount = 0
   
    ' Dial the number.
    Comm1.Output = DialString$
   
    ' Wait for "OK" to come back from the modem.
    Do
       dummy = DoEvents()
       ' If there is data in the buffer, then read it.
       If Comm1.InBufferCount Then
          FromModem$ = FromModem$ + Comm1.Input
          ' Check for "OK".
          If InStr(FromModem$, "OK") Then
             ' Notify the user to pick up the phone.
             Beep
             MsgBox "Please pick up the phone and either press Enter or click OK"
             Exit Do
          End If
       End If
       
       ' Did the user choose Cancel?
       If CancelFlag Then
          CancelFlag = False
          Exit Do
       End If
    Loop
   
    ' Disconnect the modem.
    Comm1.Output = "ATH" + Chr$(13)
   
    ' Close the port.
    Comm1.PortOpen = False
End Sub
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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

730 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