mansi sharma 7 Junior Poster in Training
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")

    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
            End If


    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.

Open Two Sites are open,
Now open site Click on button that is created with icon u added,when u clik on shows as messageBox,
Fisrt, & then

Cz all these sites are open.

I want that whether two sites are open,,O/p Should be only

AndreRet commented: Nice sample. +7