Wait for ExecFile to finish?
Blitz3D Forums/Blitz3D Programming/Wait for ExecFile to finish?
| ||
Hi, I am running a dos file using ExecFile to process an image, how can I get Blitz to wait for the Exec program to finish before continuing to run? |
| ||
The dirty way of doing it is to have the dos pogram create an empty file when it's done. Then you just loop the Blitz program if the file doesn't exist(openfile returning 0), and when it does exist the blitz program deletes it and moves on. Andy |
| ||
I guess that will work, the dos program creates a file anyway. Thanks |
| ||
I believe there is a .dll that can do that. However, I can't remember which one. :( Blitzsys ? |
| ||
>I believe there is a .dll that can do that. However, I >can't remember which one. :( Blitzsys ? Why would you want to use a dll to do what can be done in Blitz with a few lines of code? Andy |
| ||
http://www.blitzbasic.com/toolbox/toolbox.php?tool=151 I included the source with that download, too. What it does is it runs a program and gives you its Process Handle. With this process handle, you can call a few fun commands in the Windows API if you are interested, and you can check to see if the program is running. (Made nice and easy by my DLL). If you want to see that in action, I used that DLL in (in fact, I created it for) the Grasshopper Plugin System main program (linked somewhere in my signature) to efficiently, precisely and accurately run 3 different programs one after the other as quickly as possible. The technique is rather simple and can be used for lots of things, so feel free to take a look at the code and add other functionality of your own! For example, it is possible to force a program to have a particular title bar text using that technique. Anyway, there. Don't use the ugly way! :P Hope this helps :) |
| ||
Instead of writing a file on disk, is it not possible to pass to your dos program, the handle to a memory bank? It would just have to write something in memory to signal it has finished, and save your hard drive life. |
| ||
I don't think that is possible. Afaik, Windows memory is not accessible from dos. At least, not in an easy way. Mr. Picklesworth's dll is really the best solution for this. |
| ||
Just a thought.... is there any way to set an environment variable (i.e. using the DOS 'SET' command) in one program and check its value in another ? - this would (I assume) be in 'session memory' and do away with the need to write to disk. |