Get Active Window of .net application RRS feed

  • Question

  • I have an application named ProLaunch.exe. I want to get the active window in it and close it, if the user is not performing any operation with the application for a specified period. A timer in the application will be used for this purpose.

    The window will need to be closed only if it is not derived from a particular base class

    How can I get the active window and close it?


    Saturday, August 18, 2012 2:58 PM


  • I would put the timer in the form that you are trying to control.  In that form, track the last activity.  In your timer event, see if the last activity occurred within some timespan of your current time.  If the timespan is elapsed, close the form.

    • Proposed as answer by Chester Hong Wednesday, August 22, 2012 6:24 AM
    • Marked as answer by Chester Hong Tuesday, August 28, 2012 9:34 AM
    Saturday, August 18, 2012 3:35 PM