我用WebBrowser1.Navigate 调用网页,默认是ie打开的,我怎么能改默认的浏览器呀,例如用 chrome 打开
我用WebBrowser1.Navigate 调用网页,默认是ie打开的,我怎么能改默认的浏览器呀,例如用 chrome 打开
[解决办法]
我疯了,怎么用WebBrowser1.Navigate 调用网页却是IE打开的??你写错了吧
[解决办法]
大致理解你的意思,想使用默认浏览器打开一个网页,是么?
在代码窗口的顶部粘贴API声明:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Call ShellExecute(0, vbNullString, "http://www.lijiejie.com/", vbNullString, vbNullString, SW_SHOWNORMAL)
private void webBrowser_NewWindow(object sender, CancelEventArgs e)
{
e.Cancel = true;
System.Diagnostics.Process.Start(webBrowser.Url.AbsoluteUri);
}
private void webBrowser_NewWindow(object sender, CancelEventArgs e)
{
e.Cancel = true;
string currentUri = ((WebBrowser)sender).Document.ActiveElement.GetAttribute("href");
System.Diagnostics.Process.Start(currentUri);
}