Get Url From IE
Please support our VB.NET advertiser: DiscountASP.NET – 3 Months Free on VB.NET Web Hosting
![]() |
•
•
Posts: 42
Reputation:
Solved Threads: 0
vbnet Syntax (Toggle Plain Text)
Imports mshtml Imports SHDocVw Imports Microsoft.Win32 Imports System.Runtime.InteropServices Public Class Form1 Public Const BaseKey As String = "SOFTWARE\Microsoft\Internet Explorer\Extensions" Public Const SubKey As String = "{10954C80-4F0F-11d3-B17C-00C0DFE39736}" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim reg As RegistryKey = Registry.LocalMachine Dim sk As RegistryKey = reg.OpenSubKey(BaseKey, True) sk = sk.CreateSubKey(SubKey) sk.SetValue("ButtonText", "Button") sk.SetValue("CLSID", "{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}") sk.SetValue("Default Visible", "Yes") sk.SetValue("Exec", "D:\Working\IEToolbarButtons\IEToolbarButtons\bin\Debug\IEToolbarButtons.exe") sk.SetValue("HotIcon", "C:\Windows\System\setup.ico") sk.SetValue("Icon", "C:\Windows\System\setup.ico") sk.Close() reg.Close() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim browser As SHDocVw.InternetExplorer Dim myLocalLink As String Dim myDoc As mshtml.IHTMLDocument2 Dim shellWindows As SHDocVw.ShellWindows = New SHDocVw.ShellWindows() Dim filename As String For Each ie As SHDocVw.InternetExplorer In shellWindows filename = System.IO.Path.GetFileNameWithoutExtension(ie.FullName).ToLower() If filename = "iexplore" Then browser = ie myDoc = browser.Document myLocalLink = myDoc.url MessageBox.Show(myLocalLink) End If Next End End Sub End Class
mshtml-->Add reference microsoft.mshtml
SHDocVw--> Go to Add Reference-->Go to Broese tab-->C:--Windows--System32--shdocvw.dll
sk.SetValue("HotIcon", "C:\Windows\System\setup.ico")
C:\Windows\System\setup.ico--In place of it,Add any icon that has extension .ico,cz its not a valid ico file.
OUTPUT--
Open Two Sites are open google.com, daniweb.com.
Now open site yahoo.com. Click on button that is created with icon u added,when u clik on it.it shows as messageBox,
Fisrt google.com,daniweb.com & then yahoo.com
Cz all these sites are open.
I want that whether two sites are open google.com,daniweb.com,O/p Should be only yahoo.com
Last edited by cscgal : Sep 7th, 2008 at 8:36 pm. Reason: Added code tags
![]() |
Similar Threads
Other Threads in the VB.NET Forum
- Save Time and Effort in Typing URL Addresses (Windows tips 'n' tweaks)
- How to keep new URL's on top?? (Web Browsers)
- URL changing (Linux Servers and Apache)
- IE Cache not deleting a URL (Web Browsers)
- URL Changes!! (Web Browsers)
- IE URL Suffix (Web Browsers)
- url redirects to yahoo.com (Windows NT / 2000 / XP / 2003)
Other Threads in the VB.NET Forum
- Previous Thread: Strange MenuStrip Behaviour
- Next Thread: I am needing a control array, but VB.NET doesn't support them...
•
•
•
•
Views: 1988 | Replies: 0 | Currently Viewing: 1 (0 members and 1 guests)





Linear Mode