在 Windows 上显示隐藏进程?

发布于 2024-07-20 07:07:54 字数 1679 浏览 5 评论 0原文

我遇到了一点问题。

与我之前关于 Slipstreamed SP3 与修补 SP3 的问题相关,我们得出的结论是,有一个 Internet Explorer 进程正在启动,指示从本地磁盘加载一个简单的 .html 文件,其中包含 javascript,这将打开一个更大的聊天/会议的其余部分系统。 Internet Explorer 从 Lotus Notes 客户端启动。

不幸的是,我们只能看到任务管理器中弹出 IExplore.exe 进程,几秒钟后又消失了。

如果我们尝试打开在磁盘上找到的本地 .html 文件,它会在顶部显示信息栏,告诉我们它已禁用活动内容。 然而,这并不是真正的问题。 我们有另一台具有相同设置但一切正常的机器,并且手动加载 .html 文件也会给我们带来相同的错误。

但是,当从笔记启动 IExplore 时,可能会显示另一条错误消息,但由于此过程应该只是启动系统的其余部分,并且此窗口是隐藏的,所以我们看不到它,即错误消息/问题。

所以,我想,也许我应该尝试创建一个小程序,等待 IExplore.exe 启动,然后立即显示窗口,以便我们可以看到错误消息,或者任何问题。 至少,希望我们能够看到这一点。

到目前为止一切顺利,除了如果我从自己的程序启动一个带有隐藏窗口的进程时,主窗口句柄为 0,因此我最终无法显示该窗口。 我预计从 Lotus Notes 启动的 IExplore.exe 进程也有同样的问题。

我的监控程序是用 C# 编写的,基本上运行这个循环:

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

这会获取所有 IExplore.exe 进程,无论是否有窗口,并且使用 IE8,我会按照预期为第一个窗口获取 2 个进程。 我一遍又一遍地运行这个,并处理与之前运行的差异。

然而,该进程在开始时短暂地有一个窗口句柄 0,所以我将其更改为:

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

但现在它根本不会拾取任何内容,即使在窗口获得句柄之后(是的,process.MainWindowHandle 确实有显示窗口后的非零句柄值,但在窗口从未显示的情况下,它保持为 0。)

所以,问题是:我有什么方法可以获取这个隐藏的 IExplore.exe 进程,并指示它在还没有窗口句柄时显示自己? 我对此表示怀疑,但也许有人可以证明我错了。

如果没有,我的后备计划是创建一个填充程序 IExplore.exe 程序,它将所有命令行参数转发到原始命令行参数,但它指定要显示的窗口除外。 这会是一个解决方案吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉默的熊 2024-07-27 07:07:54

我不相信有任何方法可以强制没有窗口句柄的 IE 窗口为自己分配窗口句柄(或使用先前分配的窗口句柄)并显示自己。

至于您的备份方法:我认为这可行,但您正在危险的领域工作。 实际上,我建议编写垫片以记录 iexplore.exe 的每次调用以及其中的所有内容,并使用它来描述您的问题; 只有在通过完全良性的日志记录彻底描述您的问题之后,我才会建议可能修改参数以强制 iexplore.exe 显示一个窗口。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文