Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. coms between two applications

coms between two applications

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Winter
    wrote on last edited by
    #1

    Hi I have two applications - one written in c (dos window), the other in VC++, which need to communicate a variable value to each other. I currently do this by writing the value into a file from one application, and then reading it back in the other application. This all works, but I was wondering whether there is a more elegant way of doing this? Anyone help? Thanks Mike

    D 1 Reply Last reply
    0
    • M Mike Winter

      Hi I have two applications - one written in c (dos window), the other in VC++, which need to communicate a variable value to each other. I currently do this by writing the value into a file from one application, and then reading it back in the other application. This all works, but I was wondering whether there is a more elegant way of doing this? Anyone help? Thanks Mike

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      There are several forms of Interprocess Communication (IPC). For example: clipboard, DDE, WM_COPYDATA, pipes, sockets, RPC. What you have will probably work as long as you don't encounter the reader/writer problem.


      "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

      M 1 Reply Last reply
      0
      • D David Crow

        There are several forms of Interprocess Communication (IPC). For example: clipboard, DDE, WM_COPYDATA, pipes, sockets, RPC. What you have will probably work as long as you don't encounter the reader/writer problem.


        "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

        M Offline
        M Offline
        Mike Winter
        wrote on last edited by
        #3

        Thanks for your help What I have done is writen the data into a tempory file, and then renamed it to the actual file name that is required - this does appear to get over any file sharing problems that may have been encountered, and does work. The old C program that I have is written using Quick C, and (as far as I know) is unable to respond to Windows Messages, or use the clipboard, sockets, etc. In the VC app, I have set up a timer, which checks every 500mS (this is fast enough) to see if the file is there - if it is, it reads in the data. I am happy with the way the apps work at the moment, I just wanted to use a neater method of doing this, if possible. Mike

        B 1 Reply Last reply
        0
        • M Mike Winter

          Thanks for your help What I have done is writen the data into a tempory file, and then renamed it to the actual file name that is required - this does appear to get over any file sharing problems that may have been encountered, and does work. The old C program that I have is written using Quick C, and (as far as I know) is unable to respond to Windows Messages, or use the clipboard, sockets, etc. In the VC app, I have set up a timer, which checks every 500mS (this is fast enough) to see if the file is there - if it is, it reads in the data. I am happy with the way the apps work at the moment, I just wanted to use a neater method of doing this, if possible. Mike

          B Offline
          B Offline
          Blake Miller
          wrote on last edited by
          #4

          You might want to look into the ReadDirectoryChanges function for your 32-bit application, so your timer does not have to exist. Your program will be 'signaled' when the file appears in the folder, assuming you totally control access to the folder itself - meaning, do not choose a common folder that gets a lot of activity, or your program will be notified for every file change. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks

          J 1 Reply Last reply
          0
          • B Blake Miller

            You might want to look into the ReadDirectoryChanges function for your 32-bit application, so your timer does not have to exist. Your program will be 'signaled' when the file appears in the folder, assuming you totally control access to the folder itself - meaning, do not choose a common folder that gets a lot of activity, or your program will be notified for every file change. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks

            J Offline
            J Offline
            James R Twine
            wrote on last edited by
            #5

            But be careful if you are looking for changes on remote (network) shares. Both ReadDirectoryChangesW(...) and FindFirstChangeNotification(...) may experience problems when working with network shares - regarding path lengths and/or the remote system might not support notification of filesystem changes in such a manner. (Experienced this myself more than one time.)    IOW, if your application could be working with remote filesystems, it should have a polling interval as a fallback as well.  Nothing worse than getting a call first thing in the morning from a site saying that your "real-time file processing application" stopped working this morning (they upgraded a *nix box that hosted one of the shares used the previous evening, and its network file support was slightly broken).    Peace! -=- James


            If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
            Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
            DeleteFXPFiles & CheckFavorites (Please rate this post!)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups