Thread: process parameters

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    184

    process parameters

    It's me again.

    Another question of course. When starting another process, calling another executable, how would I go about returning parameters(3 integers) back to the calling program????????

    program 1 calls program 2
    program 2 executes and returns back to program 1 with 3 parameters(integers)

    How will I return the parameters in program 2 and How will I accept the parameters in program 1? This does not necessarily have to be in C#, it could be in VB or C++.

    Thanks,
    Kendal

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Returning parameters is best done calling another function ( COM object, DLL, Webservice ). You won't get many good ways of transfering results from another program back to yours when you start it as a seperate process. You can save it to a file or put it into the clipboard to read it from your program, but that are hacks. Don't start another process. Use a type that can have functions that can retun values ( or structs or have reference parameters ) like OCX or DLL or something else.
    If you need to return only a single integer, you could use the return from main and query the ExitCode property of the process you started once it's done.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    184
    Do you have any suggestions on where to read up and maybe get some examples on creating a COM object to where I can call a function of that object. DLL also. One quick question also.
    The situation I am in is kind of weird. My administrator designed a system in DJGPP because he had a lot of old code to pull from to make a quick development. Until me and my coworkers can design the windows replacement for the system, we are designing some small apps to fill in the gaps of his DJGPP system. That is where this little problem comes in. He is wanting to call a small windows style app to select three integers and return them to his program for later processing. Will there be a problem using a COM object or DLL since there is a development language difference??????????? Any advice????????????

    Thanks,
    Kendal

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    You can call any DLL or COM interface from .NET code very easily.

    You can also make .NET code expose a COM interface so you can call .NET assemblies from other code ( C++, VB, whatever ).

    For both variations, have a look here.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 02:14 PM
  3. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  4. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 01:43 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM