You can include an executable within your vfp app and write it to disk - then run it. I do that all the time, but I am not sure you can run it from within vfp
without writing it to disk, your os will not see it within the vfp exe
As Griff says, I think you can embed anything inside a compiled VFP exe. The project has the "Other" tab and the "Other Files" section for anything that doesn't fit in any other sections. I think you can probably put absolutely anything (within reason) into that section. I only say "within reason" because you've got file size limit and file size considerations to consider, you might also need to consider file names - just to ensure there is no confusion between files of the same name, best to be avoided.
Regardless of whether your embedded file is an exe or not, I think pretty much any file which is embedded inside the exe can be "exported", that is, written out to disk, and from that point you can do whatever you want with the file. Internal to your application or externally.
There are lots of ways of running an exe where the command originates from VFP, thinks like doing a RUN or a ShellExecute, but I believe in all instances VFP is essentially delegating that task to the Operating System to do the running and for that reason, I agree with Griff, if the OS cannot see the exe (because it is only embedded inside your exe/app) how is it going to execute it?
I don't think you can run an embedded exe from inside a VFP exe without first writing it to disk. Depending on what the execution plan of the exe is, i.e. does it run very quickly and automatically end/quit, you could in theory write the exe out to disk in some temp folder, the user's OS temp folder for example, then run it and when it is finished, delete it, if you don't want the exe to persist. That would be a problem if you can't make your VFP app wait for the external exe and in that case you'd have to schedule a clean up task to run periodically.
If you don't want the exe to persist on disk but your only option is to write it out to disk, then it is always a risk that something stops it being deleted and unless you are routinely cleaning up then it might get left on the disk for a long time or even forever when you don't want it there, but I don't know if you have any other options. I'd be interested, mainly out of curiosity, if anyone does have an alternative solution.
One last consideration I thought of is that Anti Virus (AV) applications scan files like exes to determine if they might be malicious, they look for patterns inside things like exes. I'm not going to state anything categorically but I wonder if embedding an exe inside an exe makes it more likely your exe could be false-flagged as potentially malicious or makes no difference at all. Definitely not a statement, more a pondering. Others, who have more experience of embedding exes inside their VFP exes would have more knowledge of whether it makes any difference in that regard.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.