我希望能够从IE (.NET 4)获取当前的URL。为此,我添加了对Microsoft Interner Controls的引用,并添加了代码(来自http://omegacoder.com/?p=63)。
foreach (InternetExplorer ie in new ShellWindowsClass())
{
textBox1.Text = ie.LocationURL.ToString();
}
但是我遇到了2个错误:
1] The type 'SHDocVw.ShellWindowsClass' has no constructors defined
2] Interop type 'SHDocVw.ShellWindowsClass' cannot be embedded.
Use the applicable interface instead.
如何解决这个问题?