1
Vote

Associate Context Menu to All File and Folder

description

Hi,

I am facing a issue while associating Context Menu to All Files And Folder together. Can you please guide me in to this issue. I tried with following Association Statement:

<ComServerAssociation(AssociationType.AllFiles And AssociationType.Directory)>


Regards,
Sushil Singh

comments

Countryen wrote Mar 1, 2015 at 12:32 PM

Hey Sushil,

You can't AND those enum-values.

1. They are not flags (binary) (they are 1,2,3,4,5...)

2. I think you do not AND (binary) enums in VB via "And"

-> In C# it would be AssociationType.AllFiles & AssociationType.Directory
( AND=& instead of "and" = && )

3. Also AND would not be the expected result, would it?
Imagine you have to have an Item beeing a file AND a directory?
AND is not like "this and this" more like "this AND this", afaik.

So I would either recommend trying to use OR (Or or (C#) | (binary)) or

Help : Should work fine (Direcotries "and" Files get the shellex)

<ComServerAssociation(AssociationType.AllFiles)>
<ComServerAssociation(AssociationType.Directory)>
Or rather:
<ComServerAssociation(AssociationType.AllFiles), ComServerAssociation(AssociationType.Directory)>
( I hope syntax is right ) - here just now tested example in C#:
    [COMServerAssociation(AssociationType.AllFiles)]
    [COMServerAssociation(AssociationType.Directory)]
    [ComVisible(true)]
    public class Protoype2 : SharpInfoTipHandler
Happy Day
Countryen

Countryen wrote Mar 3, 2015 at 9:22 PM

Hey again,

I wanted to correct myself: It does not include ALL Files.
.lnk (or rather "links") are not included in "all files", it seams.

Maybe a bug (does a link count as a file?) or bad call here.

Maybe the enum should be extended by a "All"-Value including really everything (if that's possible / reasonable)

Happy Day
Countryen
PS: Is there no way to "edit" the posts/comments?