|
-
Oct 23rd, 2007, 02:04 PM
#1
Thread Starter
Addicted Member
[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...
-
Oct 23rd, 2007, 02:19 PM
#2
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.
-
Oct 23rd, 2007, 05:24 PM
#3
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Oct 23rd, 2007, 06:02 PM
#4
Thread Starter
Addicted Member
Re: Pass A Variable Between Executables?
Thanks, I guess I'll stick with using an INI file.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|