Windows-7 introduced a concept of virtual folder, called ‘Libraries’.
I am working on implementing a Library with my custom action. The constraint is that, I have to stick to .NET version 2 for this 🙁
While looking around, I didn’t find any native (c/C++) API for doing this. I am planning to use Interop (p-Invoke) to make a library once I get native APIs.
Could any one point to a link or documentation which might help. If somehow I can do this directly from c# (with .NET v2), that would be great.
Thank you,
John
The concept of “virtual folder” exists already before Windows 7 and has AFAIK just been “refined”… you write you want to do this with your own custom handler…
IF you want to implement such a “virtual folder” and integrate it into Windows so that other applications can use it as a “virtual folder” then:
To implement and install a “shell extension” (which basically are a bunch of COM interfaces):
Remark: If the system you are running on doesn’t have .NET 4 then Microsoft recommended NOT to use .NET for this because of the inherent restriction with the older versions that one process can’t run multiple framework versions at the same time. Depending on the OS etc. case it could be recommended to implement this with C/C++.
Even with .NET 4 as pointed out in the comments the code injection problem remains – i.e. if any .NET app prior .NET 4 and/or with a different .NET versions than your shell extension accesses the file open dialog for example it can/will fail.
To circumvent that you need to implement a native proxy DLL which gets loaded into the respective processes (like Windows Explorer) and communicates with your .NET implementation via IPC.
In this specific case you need to build a shell extension which implements IShellLibrary.
That aside the implementation of shell extension is a really tough job… some links with information / samples / source code / libraries etc.:
To interact with a Windows 7 library see http://support.microsoft.com/kb/976027 and http://www.codeproject.com/KB/miscctrl/Windows7APICodePack.aspx and http://archive.msdn.microsoft.com/WindowsAPICodePack and http://www.codeproject.com/KB/cs/DDW7LibrariesLite.aspx . Some require .NET 3.5 but since 3.5 is just 2.0 plus some additional assemblies it might be an option…