Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Vladimir Zhuravlev
  Where is Vladimir Zhuravlev?
 Medvezhie ozera, Schelkovskiy raion
 Russia
 Vladimir Zhuravlev
 To: Jyothish KV
  Where is Jyothish KV?
 Bangalore
 India
 Jyothish KV
 Tags
Subject: RE: User Sessions in VFP?
Thread ID: 143499 Message ID: 143511 # Views: 2 # Ratings: 2
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Wednesday, August 29, 2007 1:13:18 PM         
   


I can answer only your second question about leaving user after some time, if they did not used exit
Any my program has timer object ( created in main program), timer is based on my timer class , named tmr
In main
IF "EXE" $ SYS(16,2)
	PUBLIC tmr 
	tmr = CREATEOBJECT('tmr')
ENDIF

timer event has code
It can not only to exit exe without user, but send them messages and click buttons on the forms , if forms were opened, but user is not there
This code has some specific of our program, but you can change it for you
Interval for timer in my case is 4 minutes = 6000*4
m.aliass = Alias()

If Hour(Datetime())>=0 And  Hour(Datetime())<=1
	On Error quit
	Set Notify Off

	Set Message To ''

	For iii=_vfp.Forms.Count To 1 Step -1
		If Type('_vfp.forms[iii]') = 'O'
			Try
				Do Case
				Case Type('_vfp.forms[iii].cmdcancel') = 'O'
					_vfp.Forms[iii].cmdcancel.Click()
				Case Type('_vfp.forms[iii].cmdcancel1') = 'O'
					_vfp.Forms[iii].cmdcancel1.Click()
				Case Type('_vfp.forms[iii].cmdexit') = 'O'
					_vfp.Forms[iii].cmdexit.Click()
				Otherwise
					Release _vfp.Forms[iii]
				Endcase
			Catch To m.error
				bbb = 1
				CANCEL
				quit
				throw
			Endtry

*	RELEASE _vfp.Forms[iii]
		Endif

	Endfor
		Try
			This.Interval = 0
			
*	Clear Dlls
			If Type('DbPath') != 'U'
				Set Path To (DbPath)
			Endif
			Release oApp
			Close Databases All
*	Clear All
			Set Sysmenu To Default
			Release All Extended
			Release This
			Clear Events
		Catch To m.error
			bbb = 1
			CANCEL 
			quit
		Endtry
		Return
	Endif
	If This.rn
		If Type('_Screen.ActiveForm') = 'O' And  Lower(_Screen.ActiveForm.Name)='inform'
			_Screen.ActiveForm.Release
		Endif
		Select Message, Message.msg_id , Spec From ;
			Message, msgusr  Where msgusr.Code = oApp.Owner And ;
			Message.msg_id  = msgusr.msg_id And Not msgusr.Rd ;
			into Cursor allmsg
		Locate For allmsg.Spec = .T.
		If Found()
			Replace For msgusr.msg_id = allmsg.msg_id And msgusr.Code = oApp.Owner  Rd With .T. In msgusr
			oApp.Cleanup() && Çàêðûòèå ôîðì
			oApp.Cleanup2 && Çàêðûòèå ïðèëîæåíèÿ
			This.Interval = 0
			Release This
*	Clear Dlls
			If Type('DbPath') != 'U'
				Set Path To (DbPath)
			Endif
			Release oApp
			Close Databases All
*	Clear All
			Set Sysmenu To Default
			Release All Extended
			Return
		Else
			Go Top In allmsg
			m.msg = allmsg.Message
			If Not Empty(m.msg)
				Replace For msgusr.msg_id = allmsg.msg_id And msgusr.Code = oApp.Owner  Rd With .T. In msgusr
				If Type('_Screen.ActiveForm') = 'O' And Lower(_Screen.ActiveForm.Name)='inform'
					_Screen.ActiveForm.Release
				Endif
				Do Form Inform With .F., m.msg
			Endif
		Endif
		If Used('msgusr')
			Use In msgusr
		Endif
		If Used('message')
			Use  In Message
		Endif
		If Used('allmsg')
			Use In allmsg
		Endif
		If Not Empty(m.aliass) And Used(m.aliass)
			Select (m.aliass)
		Endif
	Endif







MVP , www.foxclub.ru domain owner
100 friends are better than 100 dollars.

ENTIRE THREAD

User Sessions in VFP? Posted by Jyothish KV @ 8/29/2007 11:14:50 AM
RE: User Sessions in VFP? Posted by Ken Murphy @ 8/29/2007 1:02:53 PM
RE: User Sessions in VFP? Posted by Vladimir Zhuravlev @ 8/29/2007 1:13:18 PM