CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Posts
    9

    Question How to auto-close inactive Internet Explorer Window

    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

  2. #2
    Join Date
    Apr 1999
    Posts
    3,585
    You say you have the handle to IE. Try posting a WM_QUIT message to it: PostMessage(hwnd, WM_QUIT). If that doesn't work, try PostThreadMessage().
    Gort...Klaatu, Barada Nikto!

  3. #3
    Join Date
    Jan 2003
    Posts
    9
    tried but not working.

    Now I am going to get the process handle and use TerminateProcess()

    Anyone know how to know if the process is inactive and for how long ?

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

Featured