Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1036051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:38:26+00:00 2026-05-16T14:38:26+00:00

Good day everyone. This problem was part of another one which it as been

  • 0

Good day everyone.

This problem was part of another one which it as been solved, i realized that what i thought it was the problem after all, it wasn’t. Still thanks to that I’ve learned a couple things.

My application does loads of work with IE and from time to time, IE is redirected to a website with some bad Javascript code that ends up blocking IE interface. And consequently blocking my application too once everything on my application is running on the same Thread.

To counteract that problem, at startup my application runs a static method in another Thread that every 15 seconds does a simple check if IE is responding or not, and if IE isn’t responding, he closes all its process’s, liberating the lock on my application main Thread and then my application can resume its work.

To find if IE process’s are responding i had a simple code like this:

bool terminate = false;
foreach (System.Diagnostics.Process exe in System.Diagnostics.Process.GetProcesses())
{
    if (exe.ProcessName.StartsWith("iexplore"))
    {
        if (exe.Responding == false)
        {
            terminate = true;
            break;
        }
    }
}
// Code to close all IE process's...

In order to the Process.Responding property finds if the process is responding, and according to information on MSDN, this property needs another property named MainWindowHandle to be available in order to complete the process of checking. And if MainWindowHandle isn’t available Process.Responding always returns true even if the process isn’t responding.

And for some reason which i don’t know. In Windows XP MainWindowHandle isn’t available there so Responding isn’t accurate.

Thats why i need to know another way to find if a specific process is responding or not in Windows XP.

Any help is appreciated, thanks.

PS: If your looking for a website to freeze IE here goes: http://aboutmycollege.com/

EDIT: Following 0xA3 suggestion:

I went through all IE process’s checking if they had the MainWindowHandle property, those who had that property i send they Responding property to a MessageBox and they report correctly when IE isn’t responding on Windows 7 but not on XP.

I executed this code every 15 seconds:

        foreach (System.Diagnostics.Process exe in System.Diagnostics.Process.GetProcesses())
        {
            if (exe.ProcessName.StartsWith("iexplore"))
            {
                if (exe.MainWindowHandle == IntPtr.Zero)
                {
                    System.Windows.Forms.MessageBox.Show("Process doesn't have MainWindowHandle");
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Process Responding: " + exe.Responding.ToString());
                }
            }
        }

In Windows 7 and Xp he reports the Process’s of IE that don’t have the MainWindowHandle property, and in Windows 7 he also reports correctly when IE isn’t responding. But in XP all IE process’s with MainWindowHandle are always responding even when they aren’t.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:38:27+00:00Added an answer on May 16, 2026 at 2:38 pm

    IE is special because each tab has its own process plus there is an additional parent IE process. In fact, only the parent process will have a valid MainWindowHandle.

    Did you check whether MainWindowHandle is null for all these processes? If it isn’t I think your code should work as expected on XP as well.

    Update

    Since checking all IE instances didn’t help, the next thing I would try is to modify the timeout that is used by Process.Responding. The property internally calls the SendMessageTimeout api function and then checks the return value whether a timeout occurred. If so, the process is assumed to be hanging. The timeout is a hard-coded value of 5 seconds.

    You can call SendMessageTimeout yourself using P/Invoke and vary the timeout. Possibly a shorter value would give better results on Windows XP:

    [DllImport("user32.dll", CharSet=CharSet.Auto)]
    static extern IntPtr SendMessageTimeout(
        HandleRef hWnd, 
        int msg, 
        IntPtr wParam, 
        IntPtr lParam, 
        int flags, 
        int timeout, 
        out IntPtr pdwResult);
    
    const int SMTO_ABORTIFHUNG = 2;
    
    bool IsResponding(Process process)
    {
        HandeRef handleRef = new HandleRef(process, process.MainWindowHandle);
    
        int timeout = 2000;
        IntPtr lpdwResult;
    
        IntPtr lResult = SendMessageTimeout(
            handleRef, 
            0, 
            IntPtr.Zero, 
            IntPtr.Zero, 
            SMTO_ABORTIFHUNG, 
            timeout, 
            out lpdwResult);
    
        return lResult != IntPtr.Zero;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day everyone, this is one of those areas that is a little over
Good day everyone. I have been having the same problem all day at work
Good Day Everyone... I’m getting an unexpected WCF error complaining of Known Types which
Good day everyone! I have a problem regarding my date. It needs to be
Good day everyone. I have an audio class, that plays a .wav file. But
Good day everyone I need to execute command on linux machine this command is
Good day, everyone. I need a compiled and ready-to-use Flash lib, which is able
Good Day everyone!! One question.. or two.. Is it possible to use Expression Blend
Good day everyone, i hope you are all happy and healthy :) My problem
Good day everyone. Suppose we have a collection and a document which looks something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.