FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Auto-Close Application On Timer (Resolved)
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Auto-Close Application On Timer (Resolved)
Posted: Fri May 01, 2020 11:28 AM

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

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: Auto-Close Application On Timer
Posted: Fri May 01, 2020 12:07 PM
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Auto-Close Application On Timer
Posted: Fri May 01, 2020 02:45 PM

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
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Auto-Close Application On Timer (Resolved)
Posted: Sat May 02, 2020 08:19 AM

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 23.08 with Harbour
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Auto-Close Application On Timer (Resolved)
Posted: Sat May 02, 2020 10:10 AM
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 (fw): Select all Collapse
#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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Auto-Close Application On Timer (Resolved)
Posted: Sat May 02, 2020 10:26 AM

Send me at zip file with sources, mak, and lib and I upload your work to "Fivewin Contributions" repository

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Auto-Close Application On Timer (Resolved)
Posted: Sat May 02, 2020 10:36 AM

Thanks, Navarro
Regards

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Auto-Close Application On Timer (Resolved)
Posted: Sat May 02, 2020 10:39 AM
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 23.08 with Harbour
Posts: 99
Joined: Fri Dec 16, 2011 03:30 PM
Re: Auto-Close Application On Timer (Resolved)
Posted: Sat May 02, 2020 10:45 AM

Already sent via email to cristobal
Regards

FWH 20.04/Harbour3.2/Bcc7.40+/ilink32/Pelles 9.0
EMail: amriazkhan@gmail.com
Pakistan
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Auto-Close Application On Timer (Resolved)
Posted: Sat May 02, 2020 02:16 PM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion