【发布时间】:2011-12-09 12:51:13
【问题描述】:
我的应用程序使用特定 URL 触发 Web 浏览器。 在我的程序结束后,我想关闭我打开的网页/标签..
通过调用带有参数 a 的 EXE 文件。进程名称 B. URL 中存在的字符串
详细问题 How to kill firefox child process/tab from Java/C++
我使用 C# 方法...
我能够找到所有选项卡的进程 ID..
foreach (Process theprocess in processlist) {
if (theprocess.ProcessName == "iexplore") {
Console.WriteLine("Process: {0}\tID: {1}\tWindow name: {2}",
theprocess.ProcessName, theprocess.Id, theprocess.MainWindowTitle
);
}
}
目前我只能获取进程的窗口标题..在 IE8 中只有一个主进程的窗口标题可见..
如果我有每个标签的 pid,如何找到标签的 URL ...并且只杀死那个标签??
我得到了这个帮助 Access is denied - when trying to get the url (text) from address bar's handle
使用 SHDocVw; . .
foreach (InternetExplorer ieInst in new ShellWindowsClass()) Console.WriteLine(ieInst.LocationURL);
【问题讨论】:
标签: c# internet-explorer