Results 1 to 4 of 4

Thread: How do I communicate with a modem or with a com port?

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    34
    Hi,

    Does anyone happen to know how you can communicate with a com-port in VB? At this moment I know how to check for available com-ports on your PC and how to send a string of data to this port.

    But how do you receive output from that port?
    When I send ATI1 to my modem on COM4, then how do I receive it's reply?

    I am not using the MSCOMM control, so I guess I'd have to use API calls, but which ones?

    Does anyone know how to communicate with a com-port- and the device on the port or know where I can find some examples/tutorials?

    Thanks,

    vbDan

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

    Thumbs up comEvReceive Event

    I prefer to use MSComm OCX control, because when the InputBufferSize <> 0 then the control will fire the comEvReceive event, so you will know the Modem have reply something to you.

    May be you can try to send a "ATZ" command to Modem, and you should received a "OK" from your modem. (It depand on you modem setting, whether return result in Text format or interger format).

    for more information you can always refer to the following web site http://www.modemhelp.org/sets.html or email me

  3. #3
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    CreateFile can open handles to files, pipes, comm ports and devices. It's really rather clever ;-)


    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    tumblingdown@hotmail.com

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    34

    Connecting works. Now how should I play a wave file through my modem?

    Thank you for your replies,

    I have tried using CreateFile to open the COM port; which went ok, then I used WriteFile to send a command, which seemed to work ok and then I tried using ReadFile to see what the modem had to say, which didn't seem to work.

    I now found a control which is quite similar to the MSCOMM control, so I am amble to connect to the port and send and receive commands to and from the modem. It all seems to work using this control.

    However; I have no idea how to start playing a wave file as soon as the modem picks up the phone? I want to be able to let the person who called hear a greeting message based on his/her Caller ID.

    I would really appreciate it if someone can explain to me how to play a wave file through my modem.

    And TumblingDown? Could you perhaps show an example of how to use CreateFile, WriteFile and ReadFile to communicate with your modem?

    vbDan

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