Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB4 and Modems

Posted on 1997-04-23
5
Medium Priority
?
260 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 200 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

598 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