VB.net将url插入firefox url栏

时间:2012-11-08 03:50:14

标签: vb.net winforms firefox pinvoke

我试图将网址插入到firefox网址栏中。

我的代码:

进口:

Imports NDde.Client

代码:

Dim dde As DdeClient = New DdeClient("Firefox", "WWW_GetWindowInfo")
dde.Connect()
Dim url As String = dde.Request("URL", Integer.MaxValue)
dde.Disconnect()

此代码返回(获取)网址。

我如何插入网址?

(我尝试使用dde.Handle和findwindowex,但我不知道url栏的类名是什么(是的,我试过spy ++))

1 个答案:

答案 0 :(得分:0)

试试这个。

'///Download NDDE library from here "http://ndde.codeplex.com/"
'///Then add refrence NDde.dll in your project.

Imports NDde.Client 'import NDde Client

Button1 Click:

Dim dde As New DdeClient("Firefox", "WWW_OpenURL") 'you can also use "Opera" instead of "Firefox"
dde.Connect()
Dim url As String = dde.Request("http://www.google.com", Integer.MaxValue) 'you can replace google.com with your desired URL.
dde.Disconnect()

它将在firefox或opera浏览器URL栏中设置URL并导航它。希望这对你有所帮助。

相关问题