Page 1 of 1

Executing an .exe file from within another pb app.

Posted: Sun Sep 20, 2009 8:34 am
by UUICEO
I want to know if when using RunProgram() does PB continue to execute the original program or is program execution halted at that command until the executed program has exited. If it's the later, is there a way to get around this. I'm attempting to create an update system which sometimes needs to update the currently running .exe. I've created a small app to handle the update process but it seems as tho PB isn't releasing the initial .exe file before the update process has started and as such my updated .exe is messed up (file size should have been about 270k and it ended up being 6.5k).. Any help would be greatly appreciated.

I am currently using PB 4.40 Beta 3 on Windows XP SP3..

Re: Executing an .exe file from within another pb app.

Posted: Sun Sep 20, 2009 9:05 am
by lexvictory
UUICEO wrote:does PB continue to execute the original program or is program execution halted at that command until the executed program has exited.
Did u read the manual?
By default it starts it then continues it's own execution. It has a wait flag if needed.

Re: Executing an .exe file from within another pb app.

Posted: Sun Sep 20, 2009 6:04 pm
by UUICEO
yes I did read the manual and I know it has a wait flag. I don't want it to wait.

Re: Executing an .exe file from within another pb app.

Posted: Mon Sep 21, 2009 12:36 am
by citystate
I think that a program is locked while it's in use...

a possible workaround:
  1. program1 executes with update parameters
  2. program1 updates program2
  3. program1 executes program2 and ends
  4. program2 updates program1
  5. program2 executes program1 without update parameters and ends
  6. program1 performs new functions

Re: Executing an .exe file from within another pb app.

Posted: Mon Sep 21, 2009 4:54 am
by John Puccio
I've not actually tried this yet but, would running it from a batch file fix the problem?

JP

Re: Executing an .exe file from within another pb app.

Posted: Mon Sep 21, 2009 5:31 am
by UUICEO
My problem is how to execute any file from within the .exe that I'm trying to update without messing it up. I guess I could just create a separate update app.. but that is only a last resort.

Re: Executing an .exe file from within another pb app.

Posted: Mon Sep 21, 2009 5:46 am
by lexvictory
UUICEO wrote: I guess I could just create a separate update app..
that is the most common method as far as i know.
the other option, as mentioned, would be to use a batch file; save the updated exe as "ProgramName_update.exe" and in the batch delete "ProgramName.exe" and rename "ProgramName_update.exe"
or something along those lines.

because you can't edit a running exe without messing it up.

Re: Executing an .exe file from within another pb app.

Posted: Mon Sep 21, 2009 1:39 pm
by SFSxOI
My stuff, when I use the RunProgram, starts up the program and the original lauching program continues once the RunProgram is executed. I don't know about the update thing for sure, maybe if you ran it in a seperate thread? I had to do it in a separate thread for some CD\DVD burning stuff i put together and it seemed to work OK then for updating the original launching app in terms of status. But as far as editing I don't know.

Re: Executing an .exe file from within another pb app.

Posted: Thu Sep 24, 2009 4:21 am
by UUICEO
It was working correctly.. I neglected to reset a variable I was using which kinda messed everything up. I have it all worked out now. Thanks for the help.