Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What line of code is being executed?
Message
De
12/07/2002 07:54:26
 
 
À
12/07/2002 07:14:41
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00677430
Message ID:
00677932
Vues:
26
>>You could add a timer which checks every 5 minutes or so for the existance of a file. If the file is there you could set the coverage on. If the file is no longer there, set the coverage off
>>
>>That's how I get every user out of an application. The timer checks for a folder 'Down'. If it's there I close all forms and quit. If it is there when they start the app up, the app quits
>
>I tried the same, but I am worried about the case where the users either have open dialogs, or pending changes (which will make a dialog appear when the application tries to close the forms) - and the user is out, eating lunch for instance. Is there a way to solve this?

Well, I only do this when all (or most anyway) are out for lunch.
I also create a file (the name includes sys(0)) with fCreate() in the (shared) database folder, leave it open during the app and remove it when the app exits
This way I can see the progress once I activate the all-users-out

I do not think it would work if there's an unanswered MessageBox (pending dialogue), although there must be a way to send keystrokes to the messagebox with api. I think the messagebox is just a window with a hwnd

But it solves the pending changes

the timer calls =TerminateApplication(.T.) every 5 minutes.
*---------------------------------------------------------------------------
procedure	TerminateApplication(FromTimer)
	if( FromTimer )
		if( !directory( addbs(justpath(fullpath(dbc()))) + 'Down' ) )
			return
		endif
	endif
	
	
	=ReleaseAllForms()
	if( CloseDataBase() )
		*on shutdown
		quit
	endif

endproc
*---------------------------------------------------------------------------
procedure	ReleaseAllForms()
	local i, obj
	
	for i = _Screen.FormCount to 1 step -1
		obj = _screen.Forms[i]
		if( type('obj') == T_OBJECT )	&& may have disappeared
			if( pemstatus(Obj, 'Release',5) )
				*acti screen
				*?obj.Name
				=Obj.Release()
			endif
		endif
	endfor
endproc
*---------------------------------------------------------------------------
&& Forms release method
=this.MakeSafeToClose()

=DoDefault()
&& form.MakeSafeToClose()
local a[1], i


if( empty(aused(a)) )
	return	TRUE
endif

for i = 1 to alen(a,1)
	if( CursorGetProp('Buffering', a[i,1]) > 1 )
		=TableRevert(TRUE, a[i,1])
	endif
endfor

return	TRUE
&& form Destroy
do while( !empty(txnlevel() ) )
	rollback
enddo
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform