我寫一個附加的Internet Explorer 11爲什麼我的加載項在Internet Explorer上查看「管理加載項」菜單?
我已經添加了GUID變量:
[ComVisible(true), Guid("86524891-49EB-4F46-BAE3-C5545B81A671"), ClassInterface(ClassInterfaceType.None)]
並已加入到MSHTML和SHDOCVW 引用和已經寫ComRegister功能,註銷功能
[ComRegisterFunction]
public static void RegisterBHO(Type type)
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(BHOKEYNAME, true);
if (registryKey == null)
{
registryKey = Registry.LocalMachine.CreateSubKey(BHOKEYNAME);
}
string guid = type.GUID.ToString("B");
RegistryKey ourKey = registryKey.OpenSubKey(guid);
if (ourKey == null)
{
ourKey = registryKey.CreateSubKey(guid);
}
ourKey.SetValue("Alright", 1);
registryKey.Close();
ourKey.Close();
}
[ComUnregisterFunction]
public static void UnregisterBHO(Type type)
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(BHOKEYNAME, true);
string guid = type.GUID.ToString("B");
if (registryKey != null)
{
registryKey.DeleteSubKey(guid, false);
}
}
而且我已經設置/獲取網站功能:
public int SetSite([MarshalAs(UnmanagedType.IUnknown)] object site)
{
if (site != null)
{
webBrowser = (SHDocVw.WebBrowser)site;
webBrowser.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete);
webBrowser.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2);
webBrowser.NavigateComplete2 += WebBrowser_NavigateComplete2;
}
else
{
webBrowser.DocumentComplete -= new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete);
webBrowser.BeforeNavigate2 -= new DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2);
webBrowser.NavigateComplete2 -= WebBrowser_NavigateComplete2;
webBrowser = null;
}
return 0;
}
private void WebBrowser_NavigateComplete2(object pDisp, ref object URL)
{
}
public int GetSite(ref Guid guid, out IntPtr ppvSite)
{ IntPtr punk = Marshal.GetIUnknownForObject(webBrowser); int hr = Marshal.QueryInterface(punk,ref guid,out ppvSite); Marshal.Release(朋克); return hr; }
然後,我添加安裝項目:
所以,當我設置的項目,我看不到我的「附加」在Internet Explorer中。有什麼建議麼?
修正了問題文本的清晰度和代碼格式 – ManoDestra