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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inactivity timeout

Status
Not open for further replies.

AlanBreck1000

Programmer
Oct 20, 2005
28
0
0
US
Is there any way to close an application, gracefully of course, when a user has left the program open for hours on end with no activity?

I have an application on my primary server accessed through the Terminal Server, I do not want to close the terminal server session but want close the application only as they might and usually are in another program.

Clarion code or something else?
 
Hi!

You could try the code below OR buy vuFileTools from and use the vuIdleTime() function in that library.

Code:
! Prototype
         MODULE('WinAPI')
           GetLastInputInfo(*LASTINPUTINFO),BYTE,PASCAL,RAW
         END

Where:
! data types
LASTINPUTINFO GROUP,TYPE
cbSize         UNSIGNED(8)         !SIZE(LASTINPUTINFO)
dwTime         ULONG               ! milliseconds
              END

dwTime is the number of milliseconds since the last computer boot

! local data
LastInput  LIKE(LASTINPUTINFO)
Hours      LONG
Minutes    LONG
Seconds    LONG

! code
    IF GetLastInputInfo(LastInput)
       Hours   = INT(LastInput.dwTime / 3600000)
       Minutes = INT((LastInput.dwTime - (Hours * 3600000)) / 60000)
       Seconds = INT((LastInput.dwTime - (Hours * 3600000) - (Minutes * 60000) ) / 1000)
       ?LastInputInfo{Prop:Text} = LastInput.dwTime & ' ' & Format(Hours,@n02) & ':' & FORMAT(Minutes,@n02) & ':' & FORMAT(Seconds,@n02)
    END

The correct embed for this code is the TIMER event on the AppFrame window.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top