views:

724

answers:

1

I got a bit of a problem.

Related to my earlier questions about Slipstreamed SP3 vs. patched SP3, we've come to the conclusion that there is an Internet Explorer process being started, instructed to load a simple .html file from the local disk, which contains javascript, which opens up the rest of a larger chat/meeting system. Internet Explorer is started from a Lotus Notes client.

Unfortunately, all we can see is the IExplore.exe process popping up in Task Manager, and some seconds later, disappear again.

If we try to open the local .html file, which we've found on disk, it gives us that information bar at the top, telling us that it has disabled active content. This, however, is not the real problem. We have another machine that has the same settings but where everything works, and loading the .html file manually gives us the same error there as well.

However, perhaps there is another error message being shown when IExplore is started from notes, but since this process is supposed to just kickstart the rest of the system, and this window is hidden, we can't see it, that is, the error message / problem.

So, I thought, perhaps I should try creating a small program that waits for IExplore.exe to start, then immediately shows the window, so that we can see the error message, or whatever the problem is. At least, hopefully we'll be able to see that.

So far so good, except that if I start a process from my own program, with a hidden window, the main window handle is 0, and thus I cannot show the window after all. I expect this IExplore.exe process started from Lotus Notes to have the same issue.

My monitoring program is written in C#, and basically runs this loop:

foreach (var process in Process.GetProcesses())
{
    if (process.ProcessName.ToLower() == "iexplore")
        result.Add(process);
}

This picks up all the IExplore.exe processes, windows or not, and with IE8, I get 2 processes for the first window, as expected. I run this over and over again, and handles the differences from the previous runs.

However, the process briefly has a window handle 0 at the start, so I changed it to this:

foreach (var process in Process.GetProcesses())
{
    if (process.ProcessName.ToLower() == "iexplore" &&
        process.MainWindowHandle != IntPtr.Zero)
    {
        result.Add(process);
    }
}

but now it doesn't pick up anything at all, even after the window has gotten a handle (and yes, process.MainWindowHandle does have a non-zero handle value after the window has been shown, but in the case where the window is never shown, it stays at 0.)

So, the question is: Is there any way for me to take this hidden IExplore.exe process, and instruct it to show itself, when it doesn't have a window handle already? I doubt it, but perhaps someone can prove me wrong.

If not, my backup plan is to create a shim IExplore.exe program, that forwards all command line arguments to the original one, except that it specifies that the window is to be shown. Would this be a solution?

+1  A: 

I do not believe there is any way to force an IE window which does not have a window handle to allocate a window handle for itself (or use a previously allocated one) and display itself.

As to your backup method: I think this would work, but you're working in dangerous territory there. I'd actually recommend writing your shim to just log every invocation of iexplore.exe and everything that goes into it, and use that to characterize your problem; only after thoroughly characterizing your problem with completely benign logging would I suggest possibly modifying the parameters to force iexplore.exe to display a window.

McWafflestix
This is entirely a debugging tool, there's no way a lousy solution like that would go into production, so right now we're just going to go with the shim option to see if that helps.
Lasse V. Karlsen