close and run the same appl

close and run the same appl

Postby Silvio » Mon Feb 23, 2009 1: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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: close and run the same appl

Postby ukoenig » 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: Select all  Expand view

...
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 :lol:
Last edited by ukoenig on Tue Feb 24, 2009 1:57 pm, edited 1 time in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: close and run the same appl

Postby Silvio » Mon Feb 23, 2009 11:38 pm

danke !
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 88 guests