Automating program B based on program A's actions

This is a discussion on Automating program B based on program A's actions within the C Programming forums, part of the General Programming Boards category; I've got a program that I can manually run a circuit with using the serial port and now I need ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    2

    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    http://www.lvr.com/serport.htm
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    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: http://www.virtualperipherals.com/Vi...escription.asp That SDK may allow you to just monitor the real port like portmon does - looks pretty neat.

    gg

  4. #4
    Registered User
    Join Date
    Jun 2008
    Posts
    2
    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, 07: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21