Results 1 to 4 of 4

Thread: [RESOLVED] Pass A Variable Between Executables?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Location
    Chicago
    Posts
    136

    Resolved [RESOLVED] Pass A Variable Between Executables?

    I have an application that is currently using two EXEs. Is it possible to send a variable from one EXE to the other? I have text box as part of one EXE that I would like to populate with different messages depending on what the other EXE does. Combining the two EXEs isn't a possibility at this point.

    Thanks...
    CodeBank: Launch IE

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Pass A Variable Between Executables?

    Very possible and several different ways: DDE, Subclassing, text files & timers, and my favorite non-subclassing approach: SendMessage with WM_SetText.

    The first step is to be able to find your target window. Generally only one of the 2 need to locate the other. I use a hidden, disabled textbox on each window to communicate. Then

    1. WindowA uses Shell to activate WindowB. In the Shell command, a command line parameter is also included which contains the hWnd to WindowA's hidden text box. WindowB processes the Command$() function to get the hWnd that WindowA passed.

    2. WindowB starts communicating with WindowA by using SendMessage to the hWnd of WindowA's hidden text box, passing it the hWnd of WindowB's textbox. Now both have each other's textbox's hWnd to use for cross process communicating.

    3. And for each to know when it is being talked to, monitor the hidden textbox's Change event. Because text is simply being passed, you can format it in anyway needed, kind of like a chat program with commands & values if needed.
    Last edited by LaVolpe; Oct 23rd, 2007 at 02:26 PM.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Pass A Variable Between Executables?

    You can also use an ini file. One exe writes to it and another reads its and so fourth.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Location
    Chicago
    Posts
    136

    Re: Pass A Variable Between Executables?

    Thanks, I guess I'll stick with using an INI file.
    CodeBank: Launch IE

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