简体   繁体   English

如何向所有Windows资源管理器实例添加按钮?

[英]How can i add a button to all windows explorer instances?

I am trying to add a button to one of the existing tool bars in any windows explorer instance. 我正在尝试向任何Windows资源管理器实例中的现有工具栏之一添加按钮。

After much research i figured out that BHO (browser helper objects) are the best way to hook 经过大量研究,我发现BHO(浏览器辅助对象)是连接的最佳方法

to windows explorer. 到Windows资源管理器。

My question is : 我的问题是:

  1. Is that the correct way to go about it ? 那是正确的方法吗?
  2. In the SetSite of the BHO i get the comObject that is the explorer window. 在BHO的SetSite中,我获得了comObject,即资源管理器窗口。 What now ? 现在怎么办 ?
  3. If i can get the hWnd of the explorer window can i use win API to add my button ? 如果可以获取资源管理器窗口的hWnd,可以使用Win API添加我的按钮吗?

Note i am developing in C# for XP. 注意我正在用C#for XP开发。

Thanks. 谢谢。

1 In pre-XP you can add custom items in the default folder template because the folder window is actually a webpage. 1在XP之前的版本中,您可以在默认文件夹模板中添加自定义项目,因为文件夹窗口实际上是一个网页。 In XP and later that is no longer true. 在XP和更高版本中,这不再是事实。 A Deskband is the supported way to extend the UI. Deskband是扩展UI的受支持方式。 2 The site is the same. 2站点是相同的。 You can even sink DWebBrowserEvents2 to get notified when the folder view is ready. 您甚至可以接收DWebBrowserEvents2,以在文件夹视图准备好时得到通知。 3 using window functions on explorer is not supported. 3不支持在资源管理器上使用窗口功能。 The supported way to customize the explorer is to create deskbands. 支持的自定义资源管理器的方法是创建桌面乐队。 it is theoretically possible if you have the resource to test your code against each and every version of Windows Explorer used by your client audience and continue to do compatibility testing when each new version (or new language) of explorer.exe is released. 从理论上讲,如果您有资源可以针对客户群体使用的每个版本的Windows资源管理器测试代码,并在发布explorer.exe的每个新版本(或新语言)时继续进行兼容性测试。

BHO can not add deskband. BHO无法添加桌带。 If you want to start BHO and deskband programming, look at Paul DiLascia's article "My Band is Your Band" in the November 1999 issue of MSJ. 如果要开始BHO和桌面频带编程,请查看MSJ于1999年11月发行的Paul DiLascia的文章“ My Band is Your Band”。 There is another article "Building Browser Helper Objects with Visual Studio 2005" in MSDN for BHO. 在BSDN的MSDN中还有另一篇文章“使用Visual Studio 2005构建浏览器帮助器对象”。 Basically you need to handle the DocumentComplete and BeforeNavigate events and be careful not to access the folder view when the document is not ready. 基本上,您需要处理DocumentComplete和BeforeNavigate事件,并在未准备好文档时小心不要访问文件夹视图。 You can use any communication method that you see fit between your BHO and your deskband, such as hidden window with special window class, static variable if the two are in the same dll, shared memory, named pipe, etc. 您可以使用您认为适合的BHO与桌面带宽之间的任何通信方法,例如具有特殊窗口类的隐藏窗口,静态变量(如果两者位于同一dll中),共享内存,命名管道等。

Microsoft does not support creating In-Process extensions in managed code until .Net 4.0 Microsoft .NET 4.0之前不支持在托管代码中创建进程内扩展

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM