rianeiromiron
Programmer
Hi everyone:
I'm using WinExec to execute a command several times, each time with different parameters. Actually I'm using WinExec to run xcopy.exe to make backup of several directories. Before the xcopy is executed I create a dummy file in the source directory. After the xcopy I check for that file in the destination directory. If the file is present, the xcopy was succesfull and I move on to the next directory. The problem is that when I isue
WinExec('xcopy',myparameters)
the next line of code is executed even if the xcopy has not finished copying and because of that I cannot check for the existance of the dummy file in the destination directory.
I've been thinking in 2 solutions which I know would work but don't know how to implement:
1) Make WinExec run the command and continue to the next line of code until it has completed the file copy
2) After isuing WinExec, enter a While Do with something like this
Do While .t.
if the last WinExec is still running
do nothing
else
exit
endif
enddo
Does anyone have any ideas for this?
Thank you
I'm using WinExec to execute a command several times, each time with different parameters. Actually I'm using WinExec to run xcopy.exe to make backup of several directories. Before the xcopy is executed I create a dummy file in the source directory. After the xcopy I check for that file in the destination directory. If the file is present, the xcopy was succesfull and I move on to the next directory. The problem is that when I isue
WinExec('xcopy',myparameters)
the next line of code is executed even if the xcopy has not finished copying and because of that I cannot check for the existance of the dummy file in the destination directory.
I've been thinking in 2 solutions which I know would work but don't know how to implement:
1) Make WinExec run the command and continue to the next line of code until it has completed the file copy
2) After isuing WinExec, enter a While Do with something like this
Do While .t.
if the last WinExec is still running
do nothing
else
exit
endif
enddo
Does anyone have any ideas for this?
Thank you