Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automate application exit
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01105551
Message ID:
01105555
Views:
30
Michael,

First your specific question.

I would suggest that you call the form's release directly and do not call the click event of the command button.
LPARAMETERS nStyle
DODEFAULT()
IF thisform.lAutostart = .T.
	THISFORM.CmdProcess.Click()
	WAIT WINDOW [Waiting 10 seconds] TIMEOUT 10
	THISFORM.Release() && This line changed to call Form.Release instead of Button.Click()
ENDIF
I would also suggest other changes to your code that are simply using more acceptable OOP approaches. There is an OOP axiom that says "Methods should NEVER call events." The purpose of this axiom to to build a design where the behavior is contained in Methods and the events call those methods. This results in a design where the behavior can be elicited from anywhere without being dependant on user interaction. This would mean taking the code in the Button click events and moving it to methods of the form, then having the click events call the form methods. Your cmdExit is essentially already doing this by calling the form's release method and the suggestion above is to refactor the form's Show event to call the form method instead of the button's event. I would also suggest that you add a method to the form named DoProcess, moving the code in cmdProcess.Click() to the form method and have the cmdProcess.Click() call the Thisform.DoProcess(). Then your Show code would change to ...
LPARAMETERS nStyle
DODEFAULT()
IF thisform.lAutostart = .T.
	THISFORM.DoProcess()
	WAIT WINDOW [Waiting 10 seconds] TIMEOUT 10
	THISFORM.Release()
ENDIF
Also there is a change to your app code as below ...
DO FORM MakeBackups WITH lcAutoRun
READ EVENTS
*CLEAR EVENTS Remove this line as it is unnecessary.  You will never get here unless something has issued a CLEAR EVENTS already.

ON ERROR  && Restores system error handler.

QUIT
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform