Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ON SHUTDOWN/File - Exit
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00185955
Message ID:
00192192
Views:
20
I have code in my ON SHUTDOWN to prevent closing the app in the middle of something: this code would not be called if File-Exit were chosen. The "this" referred to in the following snippet is my application object, which has a method called cleanup that fires when File-Exit is chosen. When I am in a wait state, I am in a method called .Do, and when I am in a wait state in a form, I am in a program called DoForm: any thing else and I am not in a place that I can predictably shut down, so I beep and do a NODEFAULT to prevent shutting down.
*-- If a process is running, beep and do not allow closing of app
LOCAL lcCallingProgram
lcCallingProgram = ""

FOR I = 1 to 128
	IF EMPTY(PROGRAM(I))
		lcCallingProgram=PROGRAM(I-3)
		EXIT
	ENDIF
ENDFOR

IF UPPER(RIGHT(lcCallingProgram,3))!=".DO" AND UPPER(lcCallingProgram)!="DOFORM"
	??CHR(7)
	NODEFAULT
	RETURN
ENDIF

*-- CHANGE - RDH - Sept 17, 1996
*-- Code to release the app when close bar clicked

This.CleanUp()

*-- for some reason this delau us needed; if it not here, then
*-- you get "GoApp is not an object" message  (go figure)

=INKEY(1)

Release This
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Previous
Reply
Map
View

Click here to load this message in the networking platform