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() ENDIFI 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() ENDIFAlso 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