IE のウィンドウの列挙(C#)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; namespace Hoge { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Shell32.ShellClass shell = new Shell32.ShellClass(); SHDocVw.ShellWindows windows = (SHDocVw.ShellWindows)shell.Windows(); foreach (SHDocVw.WebBrowser wb in windows) { Console.WriteLine("loc = " + wb.LocationURL); } } } }
参照設定したものはつぎの2つ。
説明 / 名前 / パス
Microsoft Shell Controls And Automation / Interop.Shell32 / Interop.Shell32.dll
Microsoft Internet Controls / Interop.SHDocVw / Interop.SHDocVw.dll