Home All Groups Group Topic Archive Search About

Windows Shell Integration: how?

Author
6 Feb 2006 2:19 PM
Pieter
Hi,

I want for my application a Windows Shell Integration (for example like
TortoiseSVN: http://tortoisesvn.tigris.org/), but i can't find anything
about it??

What I basicly wnat is to be able to right-click on a file (or group of
files) in Windows Explorer, and choose 1 our 2 actions to perform with the
file(s).

Any hints, samples, web pages are really appreciated,

Thanks a lot in advance,

Pieter

Author
6 Feb 2006 3:07 PM
Vadym Stetsyak
Hello, Pieter!

You need to write shell extension. This will be COM component.
Here are the docs on the subj
( http://msdn.microsoft.com/msdnmag/issues/04/01/WindowsShell/ )
( http://www.kbcafe.com/juice/?guid=20041022155459 )
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Author
6 Feb 2006 4:28 PM
Mattias Sjögren
>You need to write shell extension. This will be COM component.

No you don't, for simple extensions like this you only really have to
add a few registry entries. It's described at

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/context.asp

And you shouldn't be writing shell extensions in managed code anyway.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
6 Feb 2006 4:45 PM
Pieter
Thanks, it seems indeed a less simpeler.
But what's the difference in performance? Isn't a 'real' shell extension
faster? Because with your solution the application isn't yet running...

Just to get a better idea...

Thanks in every case!

Show quoteHide quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:eVgCGpzKGHA.2012@TK2MSFTNGP14.phx.gbl...
> >You need to write shell extension. This will be COM component.
>
> No you don't, for simple extensions like this you only really have to
> add a few registry entries. It's described at
>
> http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/context.asp
>
> And you shouldn't be writing shell extensions in managed code anyway.
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
Author
6 Feb 2006 4:58 PM
Mattias Sjögren
>But what's the difference in performance? Isn't a 'real' shell extension
>faster?

I doubt it. If anything, reducing the number of extensions should make
Explorer perform better or at least keep the working set down.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
7 Feb 2006 9:06 AM
Pieter
Ok Thanks. It works, but I still have two small problems which I can't
resolve:
- When I select more than one (x) file and I choose the command in the
Context Menu, it opens my application x times... I would like to open it
only once, and get an array of the selected files...
- How can I get an Icon at the left of my command in the context menu? i
tryed to play a little bit around with the DefaultIcon, but that didn't
work, and I can't find it by looking at the other things in the registry :-:

Thanks a lot!
Author
8 Feb 2006 4:13 PM
Mattias Sjögren
>- When I select more than one (x) file and I choose the command in the
>Context Menu, it opens my application x times... I would like to open it
>only once, and get an array of the selected files...
>- How can I get an Icon at the left of my command in the context menu? i
>tryed to play a little bit around with the DefaultIcon, but that didn't
>work, and I can't find it by looking at the other things in the registry :-:


These are things you can only do with a full blown context menu shell
extensions, which is what Vadym mentioned initially. But again, they
shouldn't be written in managed code.


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
6 Feb 2006 4:45 PM
Vadym Stetsyak
Hello, Mattias!

MS> http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programm
MS> ersguide/shell_basics/shell_basics_extending/context.asp

Indeed, Mattias, that is much more simpler :8-)

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Author
6 Feb 2006 5:10 PM
Richard Grimes [MVP]
Vadym Stetsyak wrote:
> You need to write shell extension. This will be COM component.

<pedantmode>
Shell extensions do not use COM. They are COM-like, but they are not
activated by COM and they do not run in COM apartments. If you try to
instantiate a COM object in your extension code you will get an error
from COM stating that no COM apartment has been initialised.

I asked someone who worked on the Win95 shell team about this and he
said it was simply because COM would have added too much to the working
set of the shell.
</pedantmode>

Richard