Executing an .exe file from within another pb app.

Just starting out? Need help? Post your questions and find answers here.
UUICEO
User
User
Posts: 57
Joined: Tue Mar 10, 2009 9:09 pm
Location: Shakopee, Minnesota. USA

Executing an .exe file from within another pb app.

Post 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..
Windows 7 Ultimate x64 / PureBasic 5.21 LTS / ProGUI Platinum / PureVision / http://www.linkedin.com/groups/PureBasi ... =&trk=tyah
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

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

Post 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.
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
UUICEO
User
User
Posts: 57
Joined: Tue Mar 10, 2009 9:09 pm
Location: Shakopee, Minnesota. USA

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

Post by UUICEO »

yes I did read the manual and I know it has a wait flag. I don't want it to wait.
Windows 7 Ultimate x64 / PureBasic 5.21 LTS / ProGUI Platinum / PureVision / http://www.linkedin.com/groups/PureBasi ... =&trk=tyah
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

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

Post 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
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
User avatar
John Puccio
User
User
Posts: 26
Joined: Fri Jun 12, 2009 6:56 am
Location: My Keyboard

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

Post by John Puccio »

I've not actually tried this yet but, would running it from a batch file fix the problem?

JP
UUICEO
User
User
Posts: 57
Joined: Tue Mar 10, 2009 9:09 pm
Location: Shakopee, Minnesota. USA

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

Post 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.
Windows 7 Ultimate x64 / PureBasic 5.21 LTS / ProGUI Platinum / PureVision / http://www.linkedin.com/groups/PureBasi ... =&trk=tyah
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

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

Post 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.
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

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

Post 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.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
UUICEO
User
User
Posts: 57
Joined: Tue Mar 10, 2009 9:09 pm
Location: Shakopee, Minnesota. USA

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

Post 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.
Windows 7 Ultimate x64 / PureBasic 5.21 LTS / ProGUI Platinum / PureVision / http://www.linkedin.com/groups/PureBasi ... =&trk=tyah
Post Reply