Results 1 to 8 of 8

Thread: application idle

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    application idle

    how to recognize that an application is idle for some time interval ?
    for example i have an application made in vb. some times users keep it open and go some other place.
    i want a way to recognize that my application is in idle position for say 1/2 hr or more.
    i.e it is just opened but not have any action on it in some interval.
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: application idle

    Try this

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: application idle

    thanks. danasegarane.
    but on which form event should i write this. because i m having MDI interface.
    many forms.
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: application idle

    Write on the Main form Event

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: application idle

    thanks.
    i will try.
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  6. #6
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: application idle

    Here is another way:
    VB Code:
    1. 'Create a new project with a timer control
    2.  
    3. Option Explicit
    4.  
    5. Private Type LASTINPUTINFO
    6.     cbSize As Long
    7.     dwTime As Long
    8. End Type
    9.  
    10. Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
    11.  
    12. Dim test As Long
    13.  
    14. Private Sub Timer1_Timer()
    15.     Dim lii As LASTINPUTINFO
    16.     lii.cbSize = Len(lii)
    17.     Call GetLastInputInfo(lii)
    18.     If test = lii.dwTime Then
    19.         Debug.Print "Idle " & Format$(Now, "dd-mmm-yyyy HH:mm:ss")
    20.     Else
    21.         Debug.Print "Not Idle " & Format$(Now, "dd-mmm-yyyy HH:mm:ss")
    22.     End If
    23.     test = lii.dwTime
    24. End Sub
    CS

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: application idle

    thanks.
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  8. #8
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: application idle

    When you have received an answer to your question, please mark it as Resolved using the Thread Tools menu.
    CS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width