Thread: Automating program B based on program A's actions

  1. #1
    Registered User
    Join Date
    Jun 2008

    Question Automating program B based on program A's actions

    I've got a program that I can manually run a circuit with using the serial port and now I need to make this work automatically based on an existing program.

    This program does 2 things when I want mine to run: Transmits data on another serial port and plays a sound.

    My original idea was to poll the port to see when data was being sent, but unfortunately I can't open the port while this other program is running.

    So I guess my question is: Is there any way to make my program detect when a sound is played? (preferably a specific sound, but any sound would be fine too)
    Or is there another way to check when data is being sent?

    I've spent a few hours googling this with no avail

    I've learned all of my port programming in the last couple of days, so maybe there is something really obvious I'm missing...

    I hope that explains my problem clearly enough and any help would be greatly appreciated.
    I'm using Dev-C++ and running windows xp
    Last edited by AELCoder; 06-13-2008 at 09:05 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    There are things such as port scanners, which allow you to listen in on a serial port.
    Perhaps that will tell you what you need to know.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Do you not have the source to this other program? Would make things Lot easier

    >> I can't open the port while this other program is running.
    "Port monitoring" has to be done at the driver level. This is what portmon does for example.

    Three possible solutions come to mind...
    1) You may be able to automate portmon (via command line parameters) to start monitoring a port and log any data to a file. You can then monitor that log file for changes to know when data has been written to the port.
    2) "Split" the cable. Basically you "splice" into the cable with another cable. You'll want to only connect the Tx line to the split cables Rx line. Plug the split cable into a 3rd COM port and monitor it for data. I've actually done this before but it's a bit "hackish". You can google("rs232 splitter")
    3) Create a virtual serial port for the app to connect to - which simply forwards reads and writes to the real serial port. Which allows you detect reads and writes. Here some resources that appear to be free: That SDK may allow you to just monitor the real port like portmon does - looks pretty neat.


  4. #4
    Registered User
    Join Date
    Jun 2008
    Awesome, monitoring the portmon log file should be all I need to finish this, if I can get my read program to stop crashing

    Thanks for the help, now I'll be able to keep my job haha

    (and ya, having the source would have made this a lot easier)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  2. Runtime error in Class, string based program.... plz help
    By PotitKing in forum C++ Programming
    Replies: 2
    Last Post: 12-24-2001, 08:15 AM
  3. Need Major Help On My Program!!
    By awkeller in forum C Programming
    Replies: 3
    Last Post: 10-17-2001, 05:44 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM