[Mono-dev] Windows Shell

Steve K grokys at googlemail.com
Thu Nov 30 09:36:47 EST 2006


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
cygwin.

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
ShellItems.

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 ");
                Console.WriteLine(item.DisplayName);
            }

            ShellItem windows = new ShellItem(@"c:\progra~1");
            Console.WriteLine();
            Console.WriteLine(windows.DisplayName);
            Console.WriteLine(windows.LargeIcon.Width);
        }

Comments welcome!

Cheers
Steve

On 11/29/06, Miguel de Icaza <miguel at ximian.com> wrote:
>
> Hello,
>
> > 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.
>
> Miguel.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061130/bf5186a2/attachment.html 


More information about the Mono-devel-list mailing list