Auto-Close Application On Timer (Resolved)

Auto-Close Application On Timer (Resolved)

Postby RiazKhan » 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
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
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer

Postby Horizon » Fri May 01, 2020 12:07 pm

Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Auto-Close Application On Timer

Postby RiazKhan » Fri May 01, 2020 2: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
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer (Resolved)

Postby Marc Venken » Sat May 02, 2020 8: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Auto-Close Application On Timer (Resolved)

Postby RiazKhan » 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: Select all  Expand view  RUN

#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
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer (Resolved)

Postby cnavarro » 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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Auto-Close Application On Timer (Resolved)

Postby RiazKhan » 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
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer (Resolved)

Postby Marc Venken » 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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1446
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Auto-Close Application On Timer (Resolved)

Postby RiazKhan » 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
User avatar
RiazKhan
 
Posts: 99
Joined: Fri Dec 16, 2011 3:30 pm
Location: Pakistan

Re: Auto-Close Application On Timer (Resolved)

Postby cnavarro » Sat May 02, 2020 2: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
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests