Hello Silvio,
How to do it :
1. Create a small application : Restart.exe
2. Inside Your Application define a RESTART - Button
What the RESTART-Button must do :
Set a Var lRestart to .T. and close the application.
After closing the Main-Window, the RESTART.exe will start.
RESTART.exe after closing, will call Your application again ( Renamed or not Renamed ).
Define a RESTART-Button inside Your Application
...
LOCAL lRestart := .F. // No restart after closing the application
....
....
// Your Restart-Button somewhere ( activate Restart )
// Action ( lRestart := .T., oWnd:End() )
....
....
ACTIVATE WINDOW oWnd MAXIMIZED
IF lRestart = .T. // Restart is activated
WINEXEC( "RESTART.exe" )
ENDIF
RETURN NIL
// ---- THE RESTART - Application ---------------------
#include "FiveWin.ch"
#define WID 350
#define HGT 200
FUNCTION Main()
local oDlg
DEFINE DIALOG oDlg SIZE 2*WID,2*HGT PIXEL
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:Resize(), RESTART(oDlg) )
WINEXEC( "Myfile.exe" )
RETURN NIL
// -------------------
FUNCTION RESTART(oDlg)
IF MsgYesNo( "Rename and Restart Application ?", " Restart Application " )
DELETE FILE "MyFile.exe"
FRENAME("MyNewFile.exe","Myfile.exe")
ENDIF
oDlg:End()
RETURN NIL
Regards
Uwe
