Results 1 to 10 of 10

Thread: Passing data between two .EXE files

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Passing data between two .EXE files

    How do I pass data from one exe file to another exe file ?

    Example :

    TEST1.EXE will send the value ( 123) to TEST2.EXE

    TEST2.EXE will use this value and do some stuff

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Passing data between two .EXE files

    The two ways that come immediately to mind are either via a text file or a database entry.

  3. #3
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Passing data between two .EXE files

    Hmmmmmmm..... I don't think that THAT is possible, but then I'm not sure.

    What you could do is write the values to a *.txt. When the other *.exe opens it should read the value of the *.txt.

    Simple example:

    Exe1.exe writes 123 to *.txt
    Shell "C:\Exe2.exe" Calling other Exe.exe


    Exe2.exe Form_Load()
    LabelInput.Caption = value *.txt = 123

    Select Case LabelInput.Caption
    Case 123
    Action
    Case Else
    Other Action
    End Select

    You understand what I'm trying to tell?


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  4. #4
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Passing data between two .EXE files

    As already suggested, you can use Text Files as a common saving point.

    There can be one more way. If you are owning both the EXEs then you can have TEST2 accept a commanline parameter. Once that is done then you can call TEST2 from TEST1 using Shell and pass 123 as a CommanLine Parameter. TEST will internally use it in whatever way it is supposed to.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    Re: Passing data between two .EXE files

    I see , well good idea , it's working allright

    Shuja , what is the command line I have to use if I own the EXEs ?

  6. #6
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Passing data between two .EXE files

    Quote Originally Posted by bomayed
    I see , well good idea , it's working allright

    Shuja , what is the command line I have to use if I own the EXEs ?
    Command Line parameter is what you pass in the Command Line. In Dir /AD /AD is the Command Line parameter passed to DIR. Same way you can have the TEST2 also accept the command line parameter. In VB we use Command$ to get the command line parameter.

    If you have the source code of both the EXE's then you can simply modify code of TEST2 exe to handle Command Line Parameters.
    Code:
     Debug.Print Command$
    The above line will show the command line parameter that was passed to the exe. Once you have done the changes in the TEST2 then you can call it like this from TEST1
    Code:
    Shell "TEST2 123"
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  7. #7
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Passing data between two .EXE files

    You can pass data between two running Apps with the WM_COPYDATA message.
    http://www.vbforums.com/showthread.php?t=370564

  8. #8
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    Re: Passing data between two .EXE files

    Since it's VB6 you can use DDE, it's built right into text boxes. You just set the LInkItem and LinkTopic. Been a while since I done it, but it's an easy & slick way to do it. Give it a shot.

  9. #9
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Passing data between two .EXE files

    Did anyone suggest WinSock?
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  10. #10
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Passing data between two .EXE files

    or DCOM?
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width