如何获取新创建的IE8窗口的过程? [英] How to obtain process of newly created IE8 window?

查看:87
本文介绍了如何获取新创建的IE8窗口的过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用.NET的的Process.Start运行IE8的IEXPLORE.EXE,如果你已经有另外一个IE8窗口中打开,然后你刚开始iexplore.exe进程将立即退出,其子进程将附加到主IE8的过程。这样做的结果是你的Process对象将被链接到一个已经退出了调用的过程,而不是正在运行的子进程。你想要做的Process对象将导致一个InvalidOperationException,告诉您该进程任何已退出。

When using .NET's Process.Start to run IE8's iexplore.exe, and if you already have another IE8 window open, then the iexplore.exe process that you just started will immediately exit, and its child process will attach to the main IE8 process. The result of this is your Process object will be linked to the "invoker" process that has already exited, but not the child process that is running. Anything you want to do to the Process object will result in an InvalidOperationException telling you the process has exited.

我如何获取链接到实际的子IE8处理的处理对象?

How do I obtain a Process object that is linked to the actual child IE8 process?

推荐答案

作为一种解决方法,你可能需要强制IE浏览器启动一个新的实例(通过 -nomerge 命令行参数):

As a workaround you may want to force IE to start a new instance (passing -nomerge command line argument):

Process objProcess = Process.Start("IEXPLORE.EXE", "-nomerge http://google.com/");

这篇关于如何获取新创建的IE8窗口的过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆