Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Quit program and restart it automatically
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01291083
Message ID:
01291115
Views:
12
You can use the windows START command to start your app.

If this is something you need to do somewhat frequently, you can start your program from a CMD file such as..

REM Beginning of MYLOADER.CMD
:TOP
delete restart.fil

myprogram.exe

IF EXIST restart.fil GOTO TOP
:END

REM End of MYLOADER.CMD

Then anytime you want to exit your program and have it immediately restart, have the program create a file called restart.fil and exit. The CMD file will pop back to the TOP label, clear the file, and restart your program.


>>>Isn't there a way, perhaps using a Windows API, to exit a program and tell Windows to immediately restart it?
>>
>>Do you want the program to exit itself and launch another instance or have another program force it to close?
>>
>>If the program doesn't close (busy, locked up, whatever) how agressive do you want to be to close it? (end task, etc....)
>
>Well, I kind of figured I could do something similar to what Dragan suggested before I even posted, but was thinking there was an API call designed for this. Anyway, I went ahead and implemented it using a Restart property on my application object. If Restart gets set to true - in this case due to a newer version of the program being downloaded - then the app does not finish loading and immediately before closing it uses ShellExecute to start itself again. This works. I thought I'd heard of a specific API for this type of thing, but maybe I was hallucinating.
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform