All,
I have tried to create a "shutdown" that will work gracefully whether I'm running my app interactively, or as a compiled .EXE but I seem to be having some "timing" issues with getting everything cleaned up. In my "STARTUP.PRG" I have this code:
Then in my menu for my "Exit" option I have:
In MAIN.DESTROY() I have:
DO CLOSEAPP IN COMMON.PRG
And That PROC IS:
The main problem is, when I exit by either the menu, or the "Close" button on the "MAIN" form, while I'm running in VFP, it does close the app, but the background remains, and if I run the app a 2nd time, I get an immediate "DO CANCLED", and if I run it the 3rd time it runs, repeat steps 1 and 2...
What's a better way to do this???
Best Regards,
Scott
"Everything should be made as simple as possible, and no simpler."![[hammer] [hammer] [hammer]](/data/assets/smilies/hammer.gif)
I have tried to create a "shutdown" that will work gracefully whether I'm running my app interactively, or as a compiled .EXE but I seem to be having some "timing" issues with getting everything cleaned up. In my "STARTUP.PRG" I have this code:
Code:
glQUITAPP = .F.
glQUITOPT = 'FOX'
glUSERID = SPACE(10)
glUSERNAME = SPACE(25)
glAXSLEVEL = 0
glMENUOFF = .F.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Do one time setup for application.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
DO SYSINIT IN COMMON
*
IF WEXIST('PROPERTIES')
DEACTIVATE WINDOW PROPERTIES
ENDIF
*
ON SHUTDOWN DO CloseApp IN COMMON.PRG
*
SET TALK OFF
*
IF NOT glQUITAPP
DO MAINMENU.MPR
* DO MENUINFO
DO FORM MAIN
DO FORM SPLASH
READ EVENTS
ENDIF
Then in my menu for my "Exit" option I have:
Code:
IF WEXIST('MAIN')
MAIN.DESTROY()
CLEAR ALL
ELSE
CLEAR EVENTS
QUIT
ENDIF
In MAIN.DESTROY() I have:
DO CLOSEAPP IN COMMON.PRG
And That PROC IS:
Code:
PROCEDURE CLOSEAPP
LOCAL lnScreenCount
ON SHUTDOWN
*
SET SYSMENU TO DEFAULT
*
CLOSE ALL
*
CLEAR EVENTS
*
IF NOT USED('STARTUP')
SELECT 0
USE DBFS\STARTUP
IF STARTUP.PRODUCTION
QUIT
ELSE
CANCEL
CLEAR ALL
ENDIF
ENDIF
The main problem is, when I exit by either the menu, or the "Close" button on the "MAIN" form, while I'm running in VFP, it does close the app, but the background remains, and if I run the app a 2nd time, I get an immediate "DO CANCLED", and if I run it the 3rd time it runs, repeat steps 1 and 2...
What's a better way to do this???
Best Regards,
Scott
"Everything should be made as simple as possible, and no simpler."
![[hammer] [hammer] [hammer]](/data/assets/smilies/hammer.gif)