Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to restart an application

Status
Not open for further replies.

paul1941

Programmer
May 25, 2006
32
BE
Hello all,

For some reasons I have to restart an application

Which code can I use after QUIT?

Regards, Paul
 
Paul,
Use CANCEL instead. QUIT tells fox, you want to exit the whole enchalada.



Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
HelloThemaniac

I forgot to say: restart automaticly from within the application

regards, Paul
 
Paul... you baffel me... why would you want your application to exit, and restart itself automatically??? I think there is something else that may be better for accomplishing what you are trying to achieve. Can you explain that please?



Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Hello TheManiac

Sorry, my problem is resolved!!!

Regards Paul
 
Hi Paul,

I know you've resolved your problem, but for everyone elses reference here is what I do...

Code:
** LOAD ANOTHER COPY OF THE APPLICATION 
** USING SYS(16) TO GET THE RUNNING PROGRAM'S FULL PATH AND NAME
BROWSER(SYS(16))
** A QUICK AS POSSIBLE - QUIT, THEREBY LEAVING THE NEW PROGRAM THE ONLY ONE RUNNING
QUIT


This is the 'wrapper' function I use to shell out:
Code:
FUNCTION BROWSER
	PARAMETER m.FILENAME,m.LINEPARAMS,m.TESTFILE
	LOCAL LNRETVAL, LCOPERATION
	PRIVATE m.FILENAME,m.LINEPARAMS,m.TESTFILE
	LCOPERATION = "Open"
	**
	DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
		INTEGER handle,;
		STRING @sFile,;
		STRING @lp,;
		STRING @DIR,;
		STRING @dir1,;
		INTEGER ncmd
	**
	IF PCOUNT() < 3
		M.TESTFILE = .T.
	ENDIF
	IF PCOUNT() < 2
		M.LINEPARAMS = ""
	ENDIF
	IF m.TESTFILE
		IF FILE(m.FILENAME)
			LNRETVAL = SHELLEXECUTE(0, LCOPERATION, m.FILENAME, m.LINEPARAMS, "", 1)
		ELSE
			MESSAGEBOX("Unable to locate the specified file:"+m.FILENAME,48,"Problem")
		ENDIF
	ELSE
		LNRETVAL = SHELLEXECUTE(0, LCOPERATION, m.FILENAME, m.LINEPARAMS, "", 1)
	ENDIF
	CLEAR DLLS SHELLEXECUTE
RETURN(.F.)

Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top