English 中文(简体)
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.

After much research i figured out that BHO (browser helper objects) are the best way to hook

to windows explorer.

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. What now ?
  3. If i can get the hWnd of the explorer window can i use win API to add my button ?

Note i am developing in 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. In XP and later that is no longer true. A Deskband is the supported way to extend the UI. 2 The site is the same. You can even sink DWebBrowserEvents2 to get notified when the folder view is ready. 3 using window functions on explorer is not supported. 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.

BHO can not add deskband. 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. There is another article "Building Browser Helper Objects with Visual Studio 2005" in MSDN for BHO. 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. 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.

Microsoft does not support creating In-Process extensions in managed code until .Net 4.0





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签