VB.NET Application : How to know idle status

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hmkaddoura
    New Member
    • Feb 2008
    • 18

    VB.NET Application : How to know idle status

    Hi all,

    any one knows how to check if my vb.net application is in an idel status or not?
    how can I keep my vb.net application not to go to idel status?

    any suggestion?


    Regards,
    HK
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Attach an event handler to the Application.Idl e event.
    That will tell you when your application is going into idle mode.

    Comment

    • hmkaddoura
      New Member
      • Feb 2008
      • 18

      #3
      Thanks..that worked greatly...

      I inserted this in the form_load
      start_idle = DateAndTime.Now
      end2_idle = DateAndTime.Now
      AddHandler Application.Idl e, New System.EventHan dler(AddressOf Application_Idl e)


      and created this function

      Private Sub Application_Idl e(ByVal sender As Object, ByVal e As EventArgs)
      end_idle = DateAndTime.Now
      If (end_idle.Subtr act(end2_idle). Seconds.ToStrin g > 1) Then
      start_idle = DateAndTime.Now
      ElseIf (end_idle.Subtr act(start_idle) .Minutes.ToStri ng >= 3) Then
      'MsgBox("idle is greater than 3")
      start_idle = DateAndTime.Now
      End If

      end2_idle = DateAndTime.Now
      End Sub

      this will pop up a message every 3 minutes of idleness :>

      thanks for the reply

      Comment

      Working...