Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContextMenu: Adding menu on right click inside a folder #68

Closed
abhinavananddba opened this issue Jan 5, 2015 · 21 comments
Closed

ContextMenu: Adding menu on right click inside a folder #68

abhinavananddba opened this issue Jan 5, 2015 · 21 comments
Assignees
Labels
critical-todo critical bug/problem that the devs need to work on
Milestone

Comments

@abhinavananddba
Copy link

I have created a context menu that targets directories , but it shows only when i right click a directory and not inside it anywhere else.

@dwmkerr dwmkerr added the critical-todo critical bug/problem that the devs need to work on label Jan 5, 2015
@dwmkerr dwmkerr added this to the v2.3 milestone Jan 5, 2015
@dwmkerr dwmkerr self-assigned this Jan 5, 2015
@sergey-tihon
Copy link

When do you plan to release v2.3

@abhinavananddba
Copy link
Author

Hi ,
Any news on when to expect the issue fixed?

@schoesa
Copy link

schoesa commented Dec 5, 2017

@dwmkerr
Copy link
Owner

dwmkerr commented Oct 19, 2018

@dwmkerr dwmkerr closed this as completed Oct 19, 2018
@BenQuigley
Copy link

BenQuigley commented Nov 15, 2018

I'm not able to get this feature working on Windows 10 with our application, even though the extension built successfully, and srm.exe installed it successfully (with srm.exe install OurExtension.dll -codebase). The Directory association works fine (the item appears in the right-click menu), but the Directory Background association does not (the menu item does not appear).

Is this all that we should have in our code? Also, to confirm, it is AssociationType.DirectoryBackground, not AssociationType.Class, @"Directory\Background" like the StackOverflow thread linked above suggests? (But I've tried both with no luck).

[ComVisible(true)]
[COMServerAssociation(AssociationType.DirectoryBackground)]
public class OurExtension : SharpContextMenu
{
   // ...
}

@Countryen
Copy link
Collaborator

@BenQuigley Works for me. What version do you use?

@BenQuigley
Copy link

Our application uses 2.2, but in my testing I used 2.6.1 because I wanted this feature and it didn't work with 2.2.

@Countryen
Copy link
Collaborator

Okay I am using 2.7.0 - but I will test it with 2.6.1 now.
I think it's a bit new feature, maybe it got better with 2.7.0

Note: 2.7.0 is the master version, Nuget-package and Release is currently missing, until another issue with registration is fixed (see other issues).

@BenQuigley
Copy link

Trying 2.7.0 right now. I bet it has something to do with this line in the changelog: "If file extension classes are not present in the registry, then SharpShell will create them. If you discover new issues with registration, it may be worth quickly checking with the prior version, as there is small risk that new issues will occur due to these changes."

@Countryen
Copy link
Collaborator

Don't think so, as the Background is no class and should definately not be missing on your system. But be careful, as other issues shows, this can remove your "DefaultIcon" bindings for file types.

@Countryen
Copy link
Collaborator

Tested it with 2.6.1 and it works for me

 .\ServerRegistrationManager.exe install .\WEX.Prototype16.dll -codebase

========================================
SharpShell - Server Registration Manager
========================================

    .\WEX.Prototype16.dll installed and registered.

@Countryen
Copy link
Collaborator

Countryen commented Nov 15, 2018

Can you share whole code? I guess you are already registering with elevated mode? Tried it with an example server?

This is my Prototype:

[ComVisible(true)]
[COMServerAssociation(AssociationType.DirectoryBackground)]
public class Prototype16Server : SharpShell.SharpContextMenu.SharpContextMenu

@Countryen
Copy link
Collaborator

Can you try to manually add the extension to the registry? This is how it should look like / how it looks on my system (Win 10, x64, 64-bit)

Computer\HKEY_CLASSES_ROOT\YOUR_SERVER_NAME@ = YOUR_SERVER_NAME

Computer\HKEY_CLASSES_ROOT\YOUR_SERVER_NAME\CLSID@ = {YOUR_SERVER_GUID}

Computer\HKEY_CLASSES_ROOT\CLSID\{YOUR_SERVER_GUID}\... -> Your Server Registration here

Computer\HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\YOUR_SERVER_NAME@ = {YOUR_SERVER_GUID}

@BenQuigley
Copy link

I'm getting "installed and registered" output from ServerRegistrationManager.exe as well. It's just that the item is not appearing in the background right-click. 2.7.0 did not fix it unfortunately.

@Countryen
Copy link
Collaborator

@BenQuigley Can you reproduce the same with one of the official example server? Would you share your full code for further testing? For me registration works and the function works (I click right mouse button on Desktop or Folder Background and the ContextMenu-Item shows and works. So either it is something wrong with your registry (can you validate the registration manually) or with your server.

@dwmkerr
Copy link
Owner

dwmkerr commented Nov 27, 2018

Reopening for now, @BenQuigley do you think you could enable logging and share the logs? (see https://github.com/dwmkerr/sharpshell/blob/master/docs/logging/logging.md)

@dwmkerr dwmkerr reopened this Nov 27, 2018
@BenQuigley
Copy link

Thanks for looking into it and the link to the logging features. I enabled logging and opened my example project...

2018-11-27 09:10:03.073Z - explorer - OurExtension: Initializing shell extension...
2018-11-27 09:10:03.081Z - explorer - OurExtension: Shell extension initialised.
Parent folder: <none>
Items: 
E:\directory

When I right-click a folder managed by our application, it works (shows our context menu item) and the logs reflect that:

2018-11-27 09:10:03.086Z - explorer - OurExtension: Query Context Menu for items: 
E:\directory
2018-11-27 09:10:11.948Z - explorer - OurExtension: Initializing shell extension...
2018-11-27 09:10:11.956Z - explorer - OurExtension: Shell extension initialised.
Parent folder: E:\
Items: 

However, when I right-click the background, it does not work. The logs reflect that; it seems to be evaluating an empty list instead of the name of the directory:

2018-11-27 09:10:11.963Z - explorer - OurExtension: Query Context Menu for items:

@BenQuigley
Copy link

Our SharpShell extension queries our application for whether the variable SelectedItemPaths is under its control.

I think the issue is that SelectedItemPaths is populated when right-clicking an item, but empty when right-clicking the DirectoryBackground.

@Countryen
Copy link
Collaborator

I think the issue is that SelectedItemPaths is populated when right-clicking an item, but empty when right-clicking the DirectoryBackground.

But isn't that wanted/expected?
If you right-click the background, there is no selected Item (or do you select items prior to that?)

I think you should consider changing that check on SelectedItemPaths and include FolderPath.

@BenQuigley
Copy link

Countryen, that fixed it. Thank you!

@dwmkerr
Copy link
Owner

dwmkerr commented Nov 27, 2018

Excellent, thanks @Countryen and @BenQuigley, glad it's working! I'll add a note to the docs on this point 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical-todo critical bug/problem that the devs need to work on
Projects
None yet
Development

No branches or pull requests

6 participants