Announcement

Collapse
No announcement yet.

passing parameters between EXEs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • passing parameters between EXEs

    Hi

    I have a program that reads in information from a couple of files on startup.
    From this program I SHELL to another EXE file. This exe-file uses the same
    information. Is it somehow possible to pass this information without having to
    set up the second EXE to read the info from file too?

    ------------------
    Henning
    Henning

  • #2
    Pass the windows handle of the first program to the second program on the command line. The second program can use this handle to send a windows message (WM_COYPDATA) containing data to be copied to the first program's memory space. Download the 32-bit Memory Sharing code from: http://dickinson.basicguru.com/code.htm

    Best Regards,
    Don

    ------------------
    dickinson.basicguru.com
    Don Dickinson
    www.greatwebdivide.com

    Comment


    • #3
      You can use a memory-mapped file. Sample Code in source code forum at.. hmm, just looked, and I guess I never posted that. SOmeone remind me, OK?

      Oh, well, the PD source code is at the IMS web site:

      http://www.infoms.com/bsp/list9-01.zip

      MCM


      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        If the information is now too great in length you could even pass
        the information via the command line and retrieve it with command$
        but im sure you've already ruled that our
        for your specific situation.




        ------------------
        Client Writeup for the CPA

        buffs.proboards2.com

        Links Page

        Comment


        • #5
          Originally posted by Fred Buffington:
          If the information is not too great in length you could even
          pass the information via the command line and retrieve it with
          command$ but im sure you've already ruled that out for your
          specific situation.
          Yes, as Fred points out, that's the quick & easy way to pass the
          data, if it consists of no more than 127 bytes.


          ------------------

          Comment


          • #6
            This topic is generally known as "InterProcess Communication" (IPC), and there are quite a few technques available. Memory Maapped files and %WM_COPYDATA are the easiest. but you can also use a mailslot, TCP, etc.

            Try searching for "IPC" at www.msdn.microsoft.com for more ideas.

            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment


            • #7
              One note about COMMAND$ (command-line parameter passing)... the "127 byte limit" mentioned above is not correct (127 was a generally true in MSDOS, but not so in Windows).

              PowerBASIC itself imposed no limits on the command-line length with SHELL/SHELL() or the amount of data that can be returned by COMMAND$. While some versions of windows allow around 2Kb for the maximum parameter length, the exact limit appears to vary from version to version of Windows.

              For example, from my experiments under Windows 2000, the limit seems to be around 2050 bytes, or thereabouts. I'm not aware of any specific MS documentation on the absolute limits for other versions of Windows.


              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Testing COMMAND$ with CreateProcess under Windows 2000 shows an apparent limit of 32Kb for the length of the command line. Testing with SHELL shows an apparent limit of 255 characters, so there may be a length limit for SHELL. I'll have to refer that to R&D.


                ------------------
                Tom Hanlin
                PowerBASIC Staff

                Comment


                • #9
                  Have you tried copy-n-paste via the clipboard?


                  ------------------
                  There are no atheists in a fox hole or the morning of a math test.
                  If my flag offends you, I'll help you pack.

                  Comment


                  • #10
                    Generally speaking, the clipboard should be left to the user to work with.

                    For example, if the user has some data in the clipboard, this will delete it, and you may end up with an unhappy user.

                    ------------------
                    Lance
                    PowerBASIC Support
                    mailto:[email protected][email protected]</A>
                    Lance
                    mailto:[email protected]

                    Comment


                    • #11
                      Thank you all



                      ------------------
                      Henning
                      Henning

                      Comment

                      Working...
                      X