In the WriteProgramString() documentation it states:
The program to use. It must have been started before with RunProgram() and the #PB_Program_Write flag.
Now lets assume I have a program called RunProgramMgr() that uses RunProgram(MyProgram). Is there a way to have MyProgram write data back to the RunProgramMgr()'s stdIn even though it was not started by RunProgram()? I know I could always write data to a file but I am curious about whether stdIn can be used.
swhite wrote: Fri Oct 10, 2025 9:06 pm
In the WriteProgramString() documentation it states:
The program to use. It must have been started before with RunProgram() and the #PB_Program_Write flag.
Now lets assume I have a program called RunProgramMgr() that uses RunProgram(MyProgram). Is there a way to have MyProgram write data back to the RunProgramMgr()'s stdIn even though it was not started by RunProgram()? I know I could always write data to a file but I am curious about whether stdIn can be used.
Thanks,
Simon
Hi Simon... I think what you are trying to do is get two separate apps that you created to communicate data with each other. I thought I had a similar need a while back and decided DDE might be the answer, which led me to this thread and might help you: viewtopic.php?p=627839#p627839
Turned out a better solution for me was to consolidate my two apps into a single app by effectively merging one app into the other using threads.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
…also, in theory (I never tried):
"#PB_Program_Connect: Connect another programs output to this programs input."
"When using the #PB_Program_Connect flag, another program must have been started before with #PB_Program_Open and #PB_Program_Read. The number returned when running this program must be passed as the 'SenderProgram' parameter to RunProgram()."
PS: Ooops, I see now that you said "not started with runprogram", so this would probably not help
PPS: There can be various "problems" to get what you need with pipes (shell), e.g., program may need to be run in interactive mode, or you may need its PID………
Last edited by Piero on Sat Oct 11, 2025 11:35 am, edited 2 times in total.
Well, stdin, stdout, and stderr are usually intended for console applications.
Nevertheless at the Win32 layer, those 3 handles are returned by GetStdHandle_()
I guess you need the API ReadFile_() and WriteFile_() functions to get it running. (educated guess, never tried)
Just because it worked doesn't mean it works. PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Axolotl wrote: Sat Oct 11, 2025 11:19 am
Well, stdin, stdout, and stderr are usually intended for console applications.
Nevertheless at the Win32 layer, those 3 handles are returned by GetStdHandle_()
I guess you need the API ReadFile_() and WriteFile_() functions to get it running. (educated guess, never tried)
I dunno **** about win API, but GetStdHandle_ seems more for "general devices" (not apps); hope I'm wrong
Oh, I am not sure if you are on window or others?
But if so, this might be interests you.... (Attention it is C/C++) Creating a Child Process with Redirected Input and Output
@Piero: I agree, you are wrong. Please follow the link.
Just because it worked doesn't mean it works. PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Axolotl wrote: Sat Oct 11, 2025 11:53 am
Oh, I am not sure if you are on window or others?
But if so, this might be interests you.... (Attention it is C/C++) Creating a Child Process with Redirected Input and Output
@Piero: I agree, you are wrong. Please follow the link.
Please forgive me; I don't have time to analyze your example code properly, but it SEEMS to me it's not direct inter-applications communication; just kinda filtering general stdout (hope I'm wrong)