2

I want to create a DeskBand to display some information on my Windows task bar, but I am struggling with implementing the functionality I need in C++. It's been about 10-15 years since I touched C++. I've been working entirely in .NET for the past 7 years.

Before you say it - I know that DeskBands are deprecated. But the suggested replacement UI element - thumbnail toolbars - don't meet my needs. I need a UI element that is constantly visible to the user no matter which application they switch to, and also that provides enough room to display a line of text - I could get by with room for 30 characters or so.

I've been able to get the DeskBand from the Windows SDK sample to compile and run, but now I need to implement some real functionality - specifically...

  • Locating the AppData\Local folder (SHGetKnownFolderPath(FOLDERID_LocalAppData...)
  • Watching an XML file for modifications. I need to parse and repaint whenever the file changes.
  • Parsing the XML file (I found pugixml)
  • Displaying some data from the XML file in my DeskBand
  • Setting a timer to repaint the DeskBand once per minute

... and I am realizing how little I know about C++, and how much I've come to depend on .NET's Base Class Library. This task would be super easy for me if I was writing it in C#. But I've learned elsewhere that you shouldn't write shell extensions in .NET.

What are my options? Is there an easier language to accomplish this in - maybe Python? Or do I have to just bite the bullet and do this in C++? If so, any advice for a .NET developer trying to implement a WinAPI shell extension in C++?

Thank you in advance.

Daniel Schilling
  • 4,829
  • 28
  • 60
  • It appears that some of my research was out-dated. Now reading up on how .NET 4.0 changes this situation... – Daniel Schilling Apr 29 '13 at 15:27
  • 2
    Don't bother attempting it with .NET 4, either: [Now that version 4 of the .NET Framework supports in-process side-by-side runtimes, is it now okay to write shell extensions in managed code?](http://blogs.msdn.com/b/oldnewthing/archive/2013/02/22/10396079.aspx). "The answer is still no." – Remy Lebeau Apr 29 '13 at 15:52
  • If performance is the only issue, I may still pursue the .NET 4.0 route. I think a five second delay is a lot less critical problem for the loading of DeskBand than it is for the display of a context menu. – Daniel Schilling Apr 29 '13 at 16:00
  • 1
    According to the article I linked to: "Although version 4 addresses the side-by-side issue, it is still the case that the .NET Framework is a high-impact runtime, and that **there are various part of COM interop in the .NET Framework that are not suitable for use in an extension model** designed around native code." – Remy Lebeau Apr 29 '13 at 16:05

1 Answers1

3

Shell Extensions are COM objects, and C++ is generally the best language to use when developing COM objects because COM was designed primarily for C++, but it is not the only language possible. COM has a standardized architecture, so you can use any language outside of .NET that supports COM object development (Delphi, VB, etc) to develop Shell Extensions (similar to how the Win32 API is primarily designed for C, but any C-compatible language can access it).

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770