I am writing a program to auto-close Internet Explorer (IE) session if there are no activities for a certain period.

I got 2 problems.

1. Can not close the IE Window.
I am using EnumWindows to loop through all the windows and get the handle to a IE, then I use "DestroyWindow(hWnd);" to close the IE. NOT working. What function should I call to close a running application window ?

2. How to know that an IE session is idle for a certain period already ?

Thanks in advance.

Leslie Guo