ProgramExitCode(), but as a string

Just starting out? Need help? Post your questions and find answers here.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Re: ProgramExitCode(), but as a string

Post by pdwyer »

Agree with NicTheQuick, StarWarsFan, you aren't making it easier to help you.
It's not like we are part of a paid group of PB support staff from whom you should expect a solution with an SLA.

I think most people reply here just to contribute to the community and the challange of solving some other PB problems that interest them.

If you could share a little more about what you are doing, as per the questions asked, I think we can likely help but we are guessing as to the context of the problem that needs to be solved.

There's two apps, one spawns the other and needs to return a result that is text and currently uses a file.

assuming that any more complexity than that is just my imagination and this is as simple as it looks then I would consider:
RunProgram() using the #PB_Program_Read flag.
AvailableProgramOutput() from the caller (maybe in the thread)
WriteProgramString() from the spawned app before exit
ReadProgramString() from the caller to catch the data

If depending on the app, this approach became too complex I might use the "preferences" option for simple comms, or have all apps pass data through a shared sqlite queue structure if interrupt-able delivery of complex data was required, then a real DB or messaging system if scale was needed across systems
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Axolotl
Enthusiast
Enthusiast
Posts: 435
Joined: Wed Dec 31, 2008 3:36 pm

Re: ProgramExitCode(), but as a string

Post by Axolotl »

yes, we are all volunteers and trying to help as good as we can.

And to add another suggestion:
On Windows you can use the WM_COPYDATA message to send strings between apps.
See netmaestro's example here: viewtopic.php?t=29781 or search the forum for WM_COPYDATA
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
Post Reply