Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File Access Denied when renaming EXE
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01402361
Message ID:
01402764
Views:
67
Hi Matt,

Yes, it's a good idea to make sure that main.exe is closed before attempting to rename it. You can do that by using FOPEN(,12) or code from http://www.berezniker.com/content/pages/visual-foxpro/check-if-exe-running-and-optionally-terminate-it

>Sergey, I'm refactoring this today and I wonder if you could give me your opinion on something.
>
>In the pseudocode scenario below, I'm concerned about the timing, when the Main.exe automatically closes upon receiving an update file from the server, and the Loader.exe fires up again and tries to call the Main.exe. I suppose it'd be best to put a loop in the loader that checks to see if the main.exe is open and waits a certain time for it to close. Do you see any problems with doing it this way?
>
>Thanks,
>-m@
>
>
>[Loader.exe ]
>If Update File Exists
>  rename main.exe to main.old
>  rename main.updt to main.exe
>endif 
>ShellExec("main.exe")
>Loade.exe exits
>
>
>
>[Main.exe]
>*--Normal execution...
>An updt file is received from the server
>Prompt user about restart, wait 10 seconds or for user to click OK. 
>ShellExec("Loader.exe")
>QUIT is issued
>main.exe closes
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform