我需要接受某人離開球隊的項目。需要採取別人的BHO項目
該項目涉及IE擴展開發。
我得到了編制該項目是沒有.vdproj
該項目被稱爲編譯罰款和使用Internet Explorer作爲擴展寄存器本身。
然而,給我的文件,雖然他們編譯得很好,但無法將自己作爲擴展名註冊到Internet Explorer。
在這種情況下需要做什麼?
//鼠標
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using SHDocVw;
using BandObjectLib;
namespace CustomFunction
{
/// <summary>
/// Registration:
/// This is a browser helper object, which is registered as a COM When we register the
/// SearchBar.dll using the regasm command.
/// Loading:
/// This COM object loaded for each IE window. As a window is created, it creates its own copy of the BHO;
/// and, when that window is closed, it destroys its copy of the BHO
/// Purpose of implementing this BHO:
/// It loads the toolbar when this BHO is instantiated.
/// Code Reference: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=509297&SiteID=1
/// </summary>
[ComVisible(true)]
[Guid("1D970ED5-3EDA-438d-BFFD-715931E2775B")]
[ClassInterface(ClassInterfaceType.None)]
public class InitToolbarBHO : IObjectWithSite
{
#region Fields
private InternetExplorer explorer;
private const string BHOKeyName = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects";
#endregion
#region Com Register/UnRegister Methods
/// <summary>
/// Called, when IE browser starts.
/// </summary>
/// <param name="t"></param>
[ComRegisterFunction]
public static void RegisterBHO(Type t)
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(BHOKeyName, true);
if (key == null)
{
key = Registry.LocalMachine.CreateSubKey(BHOKeyName);
}
string guidString = t.GUID.ToString("B");
RegistryKey bhoKey = key.OpenSubKey(guidString, true);
if (bhoKey == null)
{
bhoKey = key.CreateSubKey(guidString);
}
// NoExplorer:dword = 1 prevents the BHO to be loaded by Explorer
string _name = "NoExplorer";
object _value = (object)1;
bhoKey.SetValue(_name, _value);
key.Close();
bhoKey.Close();
}
/// <param name="t"></param>
[ComUnregisterFunction]
public static void UnregisterBHO(Type t)
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(BHOKeyName, true);
string guidString = t.GUID.ToString("B");
if (key != null)
{
key.DeleteSubKey(guidString, false);
}
}
#endregion
BHO寫的是什麼語言?向我們展示一些代碼,因爲在這一點上我們知道的比你少。 另外; 自BHO寫入以來,IE API是否已更改? 在嘗試連接到IE時,您能否在調試過程中逐步瀏覽BHO? – 2011-05-04 10:10:34
bho是用c#編寫的,自BHO寫入以來,API沒有改變。是的,我不知道我是否可以在調試模式下通過BHO。如何找到那個..雖然我知道,罰款到Internet Explorer沒有任何錯誤。至於代碼..讓我編輯原始文件 – debuggerpk 2011-05-04 10:32:35
代碼更新..請看看 – debuggerpk 2011-05-04 10:42:17