FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour close and run the same appl
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
close and run the same appl
Posted: Mon Feb 23, 2009 01:09 AM

Now from an my application I can download a exe
the exe is on a my website
the exe is the same exe of application but with another name
How I can make to close My application , renamed the exe downloaded and run this file ?

thanks

Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: close and run the same appl
Posted: Mon Feb 23, 2009 11:02 AM
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
Code (fw): Select all Collapse
...
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 :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: close and run the same appl
Posted: Mon Feb 23, 2009 11:38 PM

danke !

Best Regards, Saludos



Falconi Silvio

Continue the discussion