Auto-Close Application On Timer (Resolved)

Post Reply
User avatar
RiazKhan
Posts: 77
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Auto-Close Application On Timer (Resolved)

Post by RiazKhan »

I need to activate a timer to close files and applications when the time is over.

I would like to set a timer to 60 minutes or more, automatically close the application if the user does not interact with the application, upon detection of no keyboard input and no mouse movement.

I have auto-backup routines and various data updates to execute, but the procedure fails due to no access to data files.

As seen over many years and years, the clients never log off or exit application before leaving offices.
I want to close applications and free data files for further processing.
I have seen this forum for a possible solution but did not find any help.

Thank you in advance for any guidance
Last edited by RiazKhan on Fri May 01, 2020 2:46 pm, edited 1 time in total.
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Re: Auto-Close Application On Timer

Post by Horizon »

Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
RiazKhan
Posts: 77
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer

Post by RiazKhan »

Yes, Thanks Hakan Onemli

This is fine and works very well..
I have converted tinativo to LIB and attached it to my application.

Will upload on to servers and check results....

Regards
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: Auto-Close Application On Timer (Resolved)

Post by Marc Venken »

Hello,

I'm interested also in this app.

Can you confirm it's working and maybe share the code/lib that has a working code ?

How did you implement it into your app?
Marc Venken
Using: FWH 20.08 with Harbour
User avatar
RiazKhan
Posts: 77
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer (Resolved)

Post by RiazKhan »

Hello Mark,

Yes, I tested this extensively yesterday, in many scenarios.
It detects non-keyboard and non-mouse movement for the period defined.
It works as desired, I just activated the timer on the main window of the application.
It is activated as soon as the application is executed.

The timer is activated and valid as..

If the application is at the main windows. (Works)
If the application is in any dialog or at a GET. (Works)
If the application is minimized. (Works)
If the user has the application open of any dialog and waiting at a GET and working on a xls worksheet. (Works)

My code is below as the MAIN.PRG

Code: Select all

#include "FiveWin.Ch"

//   Declare Static Variables

   STATIC nWait_Time,cThe_Func,lTime_Cont 

*---------------------------------------------------------------------------*
 FUNCTION Main( CompPara, YearPara )
*---------------------------------------------------------------------------*

// Assign parameters to variables

   nWait_Time  := 5400000                    // = 90 Minutes  // Time to wait until calling function
   cThe_Func   := "iRtrn:=Exit(.T.)"         // Name of the function to be called when Timer time is reached
   lTime_Cont  := .F.                        // After executing the function, continue to monitor Keep as .F.

// Define main window and activate..  
   DEFINE WINDOW oMainWnd TITLE  S_Name MENU BuildMenu() ICON oIco MDI

      }
      }    your routines....
      }

   ACTIVATE WINDOW oMainWnd MAXIMIZED ON INIT (  BuildTimer( oMainWnd ) )
                  

Return( Nil )                  
                  
*---------------------------------------------------------------------------*
 FUNCTION BuildTimer( oDlg )
*---------------------------------------------------------------------------*

TinaTivo():New(nWait_Time,cThe_Func,lTime_Cont)    // Add tinativo.lib To MAK File
 
Return( Nil )
 

Mark, I do not how to upload the lib or the prg files here on the forum.
If you can share your email address, it can be sent to you.

Regards
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Auto-Close Application On Timer (Resolved)

Post by cnavarro »

Send me at zip file with sources, mak, and lib and I upload your work to "Fivewin Contributions" repository
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
RiazKhan
Posts: 77
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer (Resolved)

Post by RiazKhan »

Thanks, Navarro
Regards
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: Auto-Close Application On Timer (Resolved)

Post by Marc Venken »

cnavarro wrote:Send me mail zip file with sources, mak, and lib and I upload your work to "Fivewin Contributions" repository
I will wait for the upload to contributions, so please send to him.

Thanks
Marc Venken
Using: FWH 20.08 with Harbour
User avatar
RiazKhan
Posts: 77
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer (Resolved)

Post by RiazKhan »

Already sent via email to cristobal
Regards
FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Auto-Close Application On Timer (Resolved)

Post by cnavarro »

C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Post Reply