[Mono-dev] Windows Shell

Charlie Poole charlie at nunit.com
Thu Nov 30 14:08:27 EST 2006

Would it be useful to first have a hypothetical common interface, with a
definition of what the
semantics would be under different desktops?
I've done a lot of Shell programming, so maybe I'm thinking at too detailed
a level, but is sounds
to me like a Windows-specific thing to start out with. That's OK, but it
would be good to know
what parts are likely to be cross-platform, since you might want to package
them separately.
Just a thought :-)



From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Steve K
Sent: Thursday, November 30, 2006 6:37 AM
To: Miguel de Icaza
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Windows Shell

I have created a first iteration of the windows implementation, attached. I
have not integrated this into the mono build system, or indeed tried
compiling it with mcs yet, as I am having difficulty building mono under

Here's a brief overview of the API:

interface IShellItem - 
This acts as a common interface for ShellFolder and ShellItem. It exposes
properties such as DisplayName, SmallIcon, LargeIcon, Parent, Path.

class ShellFolder - 
Represents a folder in the Windows Shell Namepsace. ShellFolder can be
constructed with an Environment.SpecialFolder value, or from a path. It
implements IEnumerable, which allows a user to iterate over the folder's

class ShellItem - 
Represents an item in a ShellFolder. If the item is itself a folder,
ToShellFolder() will create a ShellFolder representation of the item.

I have used the namespace Mono.WindowsShell for the moment. 

An example of a program using the API:

        static void Main(string[] args) {
            ShellFolder folder = 
                new ShellFolder(Environment.SpecialFolder.Desktop);

            foreach (ShellItem item in folder) { 
                if (item.IsFolder) Console.Write("d ");

            ShellItem windows = new ShellItem(@"c:\progra~1"); 

Comments welcome!


On 11/29/06, Miguel de Icaza <miguel at ximian.com> wrote: 


> Yes, I agree with your assesment.
> As for duplicating the Windows Shell API, it would need to be
> abstracted quite significantly, as it is the single worst API I have
> used, and very much tied to the win32 implementation. 

I would create an abstraction for what you are trying to solve, and have
one implementation call into the Windows space, and another that we do
to map into the Linux world.

This is what we have in mind. 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061130/fc6a093e/attachment.html 

More information about the Mono-devel-list mailing list