Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CLOSE APPLICATION AFTER A PERIOD OF NO USE

Status
Not open for further replies.

newtoclarion

Programmer
Jul 20, 2011
66
SA
Dear all
any body have an idea how to close application after a certain period of time that user didnt do any action in that period.
 
Hi!

Read on the IDLE() command in the Help. The other way is to use the windows API.

Regards
 
Thank you Shanker,

I tried to use IDLE() command before writing this post but it didnt work with me (may be I didnt apply it will), so I did a routine using Timer and it worked fine.

Thank you again
 
Hi!

With TIMER(), how do you determine that no keyboard & mouse activity has not taken place?

Regards
 
Hi!

The Windows API approach ::

Inside the Global MAP:

MODULE('WinAPI')
sjGetLastInputInfo(*LastInputInfo),BYTE,PASCAL,RAW,NAME('GetLastInputInfo')
sjGetTickCount(),LONG,PASCAL,NAME('GetTickCount')
END


Data Section of FRAME:
LastUserInput LIKE(LastInputInfo)


EVENT:Timer of FRAME:
IF sjGetLastInputInfo(LastUserInput)
Ticks# = sjGetTickCount()

LastUserInput.dwTime = Ticks# - LastUserInput.dwTime

LUI_Hrs# = INT(LastUserInput.dwTime / 3600000)
LUI_Min# = INT((LastUserInput.dwTime - (LUI_Hrs# * 3600000)) / 60000)
LUI_Sec# = INT((LastUserInput.dwTime - (LUI_Hrs# * 3600000) - (LUI_Min# * 60000) ) / 1000)
END

The LUI_Hrs#, LUI_Min# & LUI_Sec# gives you the No User Activity time.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top