[英]How to get started with developing Internet Explorer extensions?
這里有沒有人有開發 IE 擴展的經驗,可以分享他們的知識? 這將包括代碼示例、良好示例的鏈接、流程文檔或任何內容。
我真的很想這樣做,但是我遇到了糟糕的文檔,糟糕的代碼/示例代碼/缺乏的巨大牆壁。 您可以提供的任何幫助/資源將不勝感激。
具體來說,我想從如何從 IE 擴展中訪問/操作 DOM 開始。
編輯,更多細節:
理想情況下,我想放置一個工具欄按鈕,單擊該按鈕時,會彈出一個包含指向外部站點鏈接的菜單。 我還想根據某些條件訪問 DOM 並在頁面上植入 JavaScript。
在 IE 擴展中保留信息的最佳方法是什么? 在 Firefox/Chrome/大多數現代瀏覽器中,您使用window.localStorage
,但顯然對於 IE8/IE7,這不是一個選項。 也許是 SQLite DB 之類的? 可以假設 .NET 4.0 將安裝在用戶的計算機上嗎?
我不想使用 Spice IE,因為我也想構建一個與 IE9 兼容的。 我也在這個問題中添加了 C++ 標簽,因為如果用 C++ 構建一個更好,我可以做到。
[更新] 我正在更新此答案以在Windows 10 x64和Visual Studio 2017 Community 中使用Internet Explorer 11 。 此答案的先前版本(適用於 Windows 7 x64 和 Visual Studio 2010 中的 Internet Explorer 8)位於此答案的底部。
我使用的是Visual Studio 2017 Community 、 C# 、.Net Framework 4.6.1 ,所以其中一些步驟對您來說可能略有不同。
您需要以管理員身份打開 Visual Studio來構建解決方案,以便構建后腳本可以注冊 BHO(需要注冊表訪問權限)。
首先創建一個類庫。 我打電話給我的InternetExplorerExtension 。
將這些引用添加到項目中:
"Microsoft Internet Controls"
"Microsoft.mshtml"
注意:不知何故,MSHTML 沒有在我的系統中注冊,即使我可以在添加引用窗口中找到。 這在構建時導致錯誤:
找不到類型庫“MSHTML”的包裝程序集
可以在http://techninotes.blogspot.com/2016/08/fixing-cannot-find-wrapper-assembly-for.html找到修復程序,或者,您可以運行此批處理腳本:
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
cd "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies"
regasm Microsoft.mshtml.dll
gacutil /i Microsoft.mshtml.dll
創建以下文件:
IE插件
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Microsoft.Win32;
using mshtml;
using SHDocVw;
namespace InternetExplorerExtension
{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[Guid("D40C654D-7C51-4EB3-95B2-1E23905C2A2D")]
[ProgId("MyBHO.WordHighlighter")]
public class WordHighlighterBHO : IObjectWithSite, IOleCommandTarget
{
const string DefaultTextToHighlight = "browser";
IWebBrowser2 browser;
private object site;
#region Highlight Text
void OnDocumentComplete(object pDisp, ref object URL)
{
try
{
// @Eric Stob: Thanks for this hint!
// This was used to prevent this method being executed more than once in IE8... but now it seems to not work anymore.
//if (pDisp != this.site)
// return;
var document2 = browser.Document as IHTMLDocument2;
var document3 = browser.Document as IHTMLDocument3;
var window = document2.parentWindow;
window.execScript(@"function FncAddedByAddon() { alert('Message added by addon.'); }");
Queue<IHTMLDOMNode> queue = new Queue<IHTMLDOMNode>();
foreach (IHTMLDOMNode eachChild in document3.childNodes)
queue.Enqueue(eachChild);
while (queue.Count > 0)
{
// replacing desired text with a highlighted version of it
var domNode = queue.Dequeue();
var textNode = domNode as IHTMLDOMTextNode;
if (textNode != null)
{
if (textNode.data.Contains(TextToHighlight))
{
var newText = textNode.data.Replace(TextToHighlight, "<span style='background-color: yellow; cursor: hand;' onclick='javascript:FncAddedByAddon()' title='Click to open script based alert window.'>" + TextToHighlight + "</span>");
var newNode = document2.createElement("span");
newNode.innerHTML = newText;
domNode.replaceNode((IHTMLDOMNode)newNode);
}
}
else
{
// adding children to collection
var x = (IHTMLDOMChildrenCollection)(domNode.childNodes);
foreach (IHTMLDOMNode eachChild in x)
{
if (eachChild is mshtml.IHTMLScriptElement)
continue;
if (eachChild is mshtml.IHTMLStyleElement)
continue;
queue.Enqueue(eachChild);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region Load and Save Data
static string TextToHighlight = DefaultTextToHighlight;
public static string RegData = "Software\\MyIEExtension";
[DllImport("ieframe.dll")]
public static extern int IEGetWriteableHKCU(ref IntPtr phKey);
private static void SaveOptions()
{
// In IE 7,8,9,(desktop)10 tabs run in Protected Mode
// which prohibits writes to HKLM, HKCU.
// Must ask IE for "Writable" registry section pointer
// which will be something like HKU/S-1-7***/Software/AppDataLow/
// In "metro" IE 10 mode, tabs run in "Enhanced Protected Mode"
// where BHOs are not allowed to run, except in edge cases.
// see http://blogs.msdn.com/b/ieinternals/archive/2012/03/23/understanding-ie10-enhanced-protected-mode-network-security-addons-cookies-metro-desktop.aspx
IntPtr phKey = new IntPtr();
var answer = IEGetWriteableHKCU(ref phKey);
RegistryKey writeable_registry = RegistryKey.FromHandle(
new Microsoft.Win32.SafeHandles.SafeRegistryHandle(phKey, true)
);
RegistryKey registryKey = writeable_registry.OpenSubKey(RegData, true);
if (registryKey == null)
registryKey = writeable_registry.CreateSubKey(RegData);
registryKey.SetValue("Data", TextToHighlight);
writeable_registry.Close();
}
private static void LoadOptions()
{
// In IE 7,8,9,(desktop)10 tabs run in Protected Mode
// which prohibits writes to HKLM, HKCU.
// Must ask IE for "Writable" registry section pointer
// which will be something like HKU/S-1-7***/Software/AppDataLow/
// In "metro" IE 10 mode, tabs run in "Enhanced Protected Mode"
// where BHOs are not allowed to run, except in edge cases.
// see http://blogs.msdn.com/b/ieinternals/archive/2012/03/23/understanding-ie10-enhanced-protected-mode-network-security-addons-cookies-metro-desktop.aspx
IntPtr phKey = new IntPtr();
var answer = IEGetWriteableHKCU(ref phKey);
RegistryKey writeable_registry = RegistryKey.FromHandle(
new Microsoft.Win32.SafeHandles.SafeRegistryHandle(phKey, true)
);
RegistryKey registryKey = writeable_registry.OpenSubKey(RegData, true);
if (registryKey == null)
registryKey = writeable_registry.CreateSubKey(RegData);
registryKey.SetValue("Data", TextToHighlight);
if (registryKey == null)
{
TextToHighlight = DefaultTextToHighlight;
}
else
{
TextToHighlight = (string)registryKey.GetValue("Data");
}
writeable_registry.Close();
}
#endregion
[Guid("6D5140C1-7436-11CE-8034-00AA006009FA")]
[InterfaceType(1)]
public interface IServiceProvider
{
int QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject);
}
#region Implementation of IObjectWithSite
int IObjectWithSite.SetSite(object site)
{
this.site = site;
if (site != null)
{
LoadOptions();
var serviceProv = (IServiceProvider)this.site;
var guidIWebBrowserApp = Marshal.GenerateGuidForType(typeof(IWebBrowserApp)); // new Guid("0002DF05-0000-0000-C000-000000000046");
var guidIWebBrowser2 = Marshal.GenerateGuidForType(typeof(IWebBrowser2)); // new Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E");
IntPtr intPtr;
serviceProv.QueryService(ref guidIWebBrowserApp, ref guidIWebBrowser2, out intPtr);
browser = (IWebBrowser2)Marshal.GetObjectForIUnknown(intPtr);
((DWebBrowserEvents2_Event)browser).DocumentComplete +=
new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete);
}
else
{
((DWebBrowserEvents2_Event)browser).DocumentComplete -=
new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete);
browser = null;
}
return 0;
}
int IObjectWithSite.GetSite(ref Guid guid, out IntPtr ppvSite)
{
IntPtr punk = Marshal.GetIUnknownForObject(browser);
int hr = Marshal.QueryInterface(punk, ref guid, out ppvSite);
Marshal.Release(punk);
return hr;
}
#endregion
#region Implementation of IOleCommandTarget
int IOleCommandTarget.QueryStatus(IntPtr pguidCmdGroup, uint cCmds, ref OLECMD prgCmds, IntPtr pCmdText)
{
return 0;
}
int IOleCommandTarget.Exec(IntPtr pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
{
try
{
// Accessing the document from the command-bar.
var document = browser.Document as IHTMLDocument2;
var window = document.parentWindow;
var result = window.execScript(@"alert('You will now be allowed to configure the text to highlight...');");
var form = new HighlighterOptionsForm();
form.InputText = TextToHighlight;
if (form.ShowDialog() != DialogResult.Cancel)
{
TextToHighlight = form.InputText;
SaveOptions();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return 0;
}
#endregion
#region Registering with regasm
public static string RegBHO = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects";
public static string RegCmd = "Software\\Microsoft\\Internet Explorer\\Extensions";
[ComRegisterFunction]
public static void RegisterBHO(Type type)
{
string guid = type.GUID.ToString("B");
// BHO
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegBHO, true);
if (registryKey == null)
registryKey = Registry.LocalMachine.CreateSubKey(RegBHO);
RegistryKey key = registryKey.OpenSubKey(guid);
if (key == null)
key = registryKey.CreateSubKey(guid);
key.SetValue("Alright", 1);
registryKey.Close();
key.Close();
}
// Command
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegCmd, true);
if (registryKey == null)
registryKey = Registry.LocalMachine.CreateSubKey(RegCmd);
RegistryKey key = registryKey.OpenSubKey(guid);
if (key == null)
key = registryKey.CreateSubKey(guid);
key.SetValue("ButtonText", "Highlighter options");
key.SetValue("CLSID", "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}");
key.SetValue("ClsidExtension", guid);
key.SetValue("Icon", "");
key.SetValue("HotIcon", "");
key.SetValue("Default Visible", "Yes");
key.SetValue("MenuText", "&Highlighter options");
key.SetValue("ToolTip", "Highlighter options");
//key.SetValue("KeyPath", "no");
registryKey.Close();
key.Close();
}
}
[ComUnregisterFunction]
public static void UnregisterBHO(Type type)
{
string guid = type.GUID.ToString("B");
// BHO
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegBHO, true);
if (registryKey != null)
registryKey.DeleteSubKey(guid, false);
}
// Command
{
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegCmd, true);
if (registryKey != null)
registryKey.DeleteSubKey(guid, false);
}
}
#endregion
}
}
互操作文件
using System;
using System.Runtime.InteropServices;
namespace InternetExplorerExtension
{
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")]
public interface IObjectWithSite
{
[PreserveSig]
int SetSite([MarshalAs(UnmanagedType.IUnknown)]object site);
[PreserveSig]
int GetSite(ref Guid guid, [MarshalAs(UnmanagedType.IUnknown)]out IntPtr ppvSite);
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OLECMDTEXT
{
public uint cmdtextf;
public uint cwActual;
public uint cwBuf;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public char rgwz;
}
[StructLayout(LayoutKind.Sequential)]
public struct OLECMD
{
public uint cmdID;
public uint cmdf;
}
[ComImport(), ComVisible(true),
Guid("B722BCCB-4E68-101B-A2BC-00AA00404770"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleCommandTarget
{
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int QueryStatus(
[In] IntPtr pguidCmdGroup,
[In, MarshalAs(UnmanagedType.U4)] uint cCmds,
[In, Out, MarshalAs(UnmanagedType.Struct)] ref OLECMD prgCmds,
//This parameter must be IntPtr, as it can be null
[In, Out] IntPtr pCmdText);
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int Exec(
//[In] ref Guid pguidCmdGroup,
//have to be IntPtr, since null values are unacceptable
//and null is used as default group!
[In] IntPtr pguidCmdGroup,
[In, MarshalAs(UnmanagedType.U4)] uint nCmdID,
[In, MarshalAs(UnmanagedType.U4)] uint nCmdexecopt,
[In] IntPtr pvaIn,
[In, Out] IntPtr pvaOut);
}
}
最后是一個表單,我們將使用它來配置選項。 在這個表單中放置一個TextBox
和一個 Ok Button
。 將按鈕的DialogResult設置為Ok 。 將此代碼放在表單代碼中:
using System.Windows.Forms;
namespace InternetExplorerExtension
{
public partial class HighlighterOptionsForm : Form
{
public HighlighterOptionsForm()
{
InitializeComponent();
}
public string InputText
{
get { return this.textBox1.Text; }
set { this.textBox1.Text = value; }
}
}
}
在項目屬性中,執行以下操作:
C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe
http://msdn.microsoft.com/en-us/library/ms976373.aspx#bho_getintouch
在構建事件選項卡中,將構建后事件命令行設置為:
"%ProgramFiles(x86)%\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.1 Tools\\gacutil.exe" /f /i "$(TargetDir)$(TargetFileName)"\n\n "%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\RegAsm.exe" /取消注冊 "$(TargetDir)$(TargetFileName)"\n\n "%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\RegAsm.exe" "$(TargetDir)$(TargetFileName)"
注意:即使我的計算機是 x64,我也使用了非 x64 gacutil.exe
的路徑並且它可以工作......特定於 x64 的路徑是:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\gacutil.exe
64 位 IE需要 64 位編譯和 64 位注冊 BHO。 雖然我只能使用 32 位 IE11 進行調試,但 32 位注冊擴展也可以通過運行 64 位 IE11 來運行。
這個答案似乎有一些關於這個的額外信息: https : //stackoverflow.com/a/23004613/195417
如果需要,可以使用 64 位 regasm:
%windir%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe
此附加組件的工作原理
我沒有改變附加組件的行為...看看下面的 IE8 部分的描述。
伙計……這工作量很大! 我很好奇如何做到這一點,所以我自己做了。
首先……功勞不全是我的。 這是我在這些網站上發現的內容的匯編:
當然,我希望我的回答具有您所問的功能:
我將逐步描述它,我如何設法在Windows 7 x64 中使用Internet Explorer 8做到這一點……請注意,我無法在其他配置中進行測試。 希望你明白=)
我使用的是Visual Studio 2010 、 C# 4 、 .Net Framework 4 ,因此其中一些步驟對您來說可能略有不同。
創建了一個類庫。 我打電話給我的InternetExplorerExtension 。
將這些引用添加到項目中:
注意:這些引用可能位於每台計算機的不同位置。
這是我在 csproj 中的參考部分包含的內容:
<Reference Include="Interop.SHDocVw, Version=1.1.0.0, Culture=neutral, PublicKeyToken=90ba9c70f846762e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Interop.SHDocVw.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
以與更新的 IE11 文件相同的方式創建文件。
IE插件
您可以從 IE11 版本中取消注釋以下行:
...
// @Eric Stob: Thanks for this hint!
// This was used to prevent this method being executed more than once in IE8... but now it seems to not work anymore.
if (pDisp != this.site)
return;
...
互操作文件
與 IE11 版本相同。
最后是一個表單,我們將使用它來配置選項。 在這個表單中放置一個TextBox
和一個 Ok Button
。 將按鈕的DialogResult設置為Ok 。 IE11插件的代碼相同。
在項目屬性中,執行以下操作:
C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe
http://msdn.microsoft.com/en-us/library/ms976373.aspx#bho_getintouch
在構建事件選項卡中,將構建后事件命令行設置為:
"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\NETFX 4.0 Tools\\ x64 \\gacutil.exe" /f /i "$(TargetDir)$(TargetFileName)"\n\n "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\RegAsm.exe" /取消注冊 "$(TargetDir)$(TargetFileName)"\n\n "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\RegAsm.exe" "$(TargetDir)$(TargetFileName)"
注意:由於我的電腦是 x64,所以我的機器上 gacutil 可執行文件的路徑中有一個特定的 x64,在你的機器上可能會有所不同。
64 位 IE需要 64 位編譯和 64 位注冊 BHO。 使用 64 位 RegAsm.exe(通常位於 C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\RegAsm.exe)
此附加組件的工作原理
它遍歷所有 DOM 樹,替換使用按鈕配置的文本,本身帶有黃色背景。 如果您單擊泛黃的文本,它會調用動態插入頁面的 javascript 函數。 默認詞是“瀏覽器”,所以它匹配很多! 編輯:更改要突出顯示的字符串后,您必須單擊 URL 框並按 Enter... F5 不起作用,我認為這是因為 F5 被視為“導航”,並且需要監聽導航事件(也許)。 稍后我會嘗試修復它。
現在,是時候離開了。 我很累。 隨意提問……因為我要去旅行,所以我可能無法回答……3天后我回來了,但我會在此期間嘗試來這里。
IE 擴展的狀態實際上非常令人難過。 您擁有 IE5 瀏覽器助手對象的舊模型(是的,那些臭名昭著的 BHO,當時每個人都喜歡阻止)、工具欄和新的 IE 加速器。 即便如此,兼容性有時也會中斷。 我曾經為 IE6 維護一個與 IE7 中斷的擴展,所以有些東西已經改變了。 在大多數情況下,據我所知(我已經很多年沒有接觸過 BHO),您仍然需要使用活動模板庫(有點像 Microsoft 的 COM 的 STL)對它們進行編碼,而且僅適用於 C++。 你可以用 C# 做 COM Interop,然后用 C# 做它,但它的價值可能太難了。 無論如何,如果您有興趣為 IE 編寫自己的擴展程序(如果您想在所有主要瀏覽器中使用您的擴展程序,這是合理的),這里是 Microsoft 官方資源。
http://msdn.microsoft.com/en-us/library/aa753587(v=vs.85).aspx
對於 IE8 中的新加速器,您可以查看這個。
http://msdn.microsoft.com/en-us/library/cc289775(v=vs.85).aspx
我同意文檔很糟糕,而且 API 已經過時了。 我仍然希望這會有所幫助。
編輯:我想我可以在這里拋出最后一個信息來源。 當我在 BHO 上工作時,我正在查看我的筆記。 這篇文章讓我開始接觸它們。 它有點舊,但是很好地解釋了您在使用 IE BHO(例如 IObjectWithSite)時將使用的 ATL 接口。 我認為它解釋得很好,當時對我幫助很大。 http://msdn.microsoft.com/en-us/library/bb250436.aspx我還檢查了 GregC 發布的示例。 它至少適用於 IE8,並且與 VS 2010 兼容,因此如果您想使用 C#,您可以從那里開始並查看 Jon Skeet 的書。 (C# in Depth 2nd edition)第 13 章提供了大量有關 C# 4 中新功能的信息,您可以使用這些信息使與 COM 的交互更好。 (我仍然建議你用 C++ 做你的插件)
另一種很酷的方法是檢查:
它是一個基於 JS 和 jquery 的框架,它允許您使用單個通用 JS 代碼為 IE、FF 和 Chrome 開發瀏覽器擴展。 基本上,框架完成了所有繁瑣的工作,剩下的就是編寫應用程序代碼。
開發 C# BHO 是一件麻煩事。 它涉及大量令人討厭的 COM 代碼和 p/invoke 調用。
我在這里有一個基本完成的 C# BHO,你可以隨意使用它的源代碼。 我說“主要” ,因為我從來沒有弄清楚如何在 IE 保護模式下保存 appdata 。
多年來,我一直在使用 IE 的網絡瀏覽器控件,在此過程中,一個名字一遍又一遍地出現並發布了有用的帖子:Igor Tandetnik
如果我正在開發一個擴展,我會瞄准一個 BHO,然后開始搜索:
BHO 伊戈爾·坦德尼克
或者
瀏覽器助手對象 Igor Tandetnik
他的帖子往往非常詳細,他知道自己在說什么。
您會發現自己在 COM 和 ATL 編程中耳目一新。 有關示例演練,請查看: http : //msdn.microsoft.com/en-us/library/ms976373.aspx
顯然已經解決了,但對於其他用戶,我會推薦SpicIE framework 。 我已經基於它做了我自己的擴展。 它只支持 Internet Explorer 7/8 官方,但我在 Internet Explorer 6-10 (從 Windows XP 到 Windows 8 Consumer Preview)上測試了它並且它工作正常。 不幸的是,最新版本中存在一些錯誤,因此我必須修復它們並發布自己的版本: http : //archive.msdn.microsoft.com/SpicIE/Thread/View.aspx?ThreadId=5251
我同意 Robert Harvey 的觀點,C# 4.0 具有改進的 COM 互操作性。 這是一些較舊的 C# 代碼,迫切需要重寫。
http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx
這是通過避免 ATL 並使用 Spartan COM 來簡化事情的嘗試:
如果您不想重新發明輪子,則可以嘗試Add In Express for IE 。 我已經將該產品用於VSTO 的東西,它非常好。 他們還有一個有用的論壇和快速的支持。
我熱烈推薦您這篇 Pavel Zolnikov 於 2002 年發表的文章!
http://www.codeproject.com/Articles/2219/Extending-Explorer-with-Band-Objects-using-NET-and
它基於 Band 對象的使用,並使用 .Net 2.0 編譯。 提供了源代碼,並在 Visual Studio 2013 中打開和編譯良好。正如您將在帖子評論中看到的那樣,它在 IE 11、Windows 7 和 Windows 10 上運行良好。它在 Windows 7 + SP1 和 IE 上運行良好11 享受吧!
在 Build Events 選項卡中,將 Post-build events 命令行設置為:(x64) 如下所示
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\gacutil.exe" /if "$(TargetDir)$(TargetFileName)"
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" /u "$(TargetDir)$(TargetFileName)"
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" "$(TargetDir)$(TargetFileName)"
我想要構建事件選項卡,將構建后事件命令行設置為(32 位操作系統)
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\gacutil.exe" /if "$(TargetDir)$(TargetFileName)"
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /u "$(TargetDir)$(TargetFileName)"
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" "$(TargetDir)$(TargetFileName)"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.