Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On shutdown problem
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00082315
Message ID:
00082320
Views:
30
>I have a large app, many forms/formsets, though only some open at any one time. I have a cleanup prg which runs on shutdown. All is fine except when a there are some unsaved edits in the buffer, and the user closes via the main vfp window (X, icon, menu).
>
>Then I get errors from the buffering, because the shutdown/cleanup runs before the queryunload. What's a good way to deal with this?

Bruce, I think you should have something like this code in your shutdown procedure:
local lnForm, loForm

for lnForm = _screen.formcount to 1 step - 1
	if type("_screen.Forms[lnForm]")=="O" and !isnull(_screen.forms[lnForm])
		if !(upper(_screen.forms[lnForm].class) $ "cTOOLBAR;MEMO;GENERAL")
		    if pemstatus(_screen.forms[lnForm],'QueryUnload',5)
				if _screen.forms[lnForm].queryunload()
					_screen.forms[lnForm].visible = .f.
					_screen.forms[lnForm].release()
				else
					return .f.
				endif
			else
				loForm = _screen.forms[lnForm] 
				release loForm
		    endif
		endif
	endif
endfor
HTH,

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform