[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...
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.
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.
Re: Pass A Variable Between Executables?
Thanks, I guess I'll stick with using an INI file.