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

Context menu windows 11 duplicated #328

Open
modz2014 opened this issue Aug 24, 2023 · 50 comments
Open

Context menu windows 11 duplicated #328

modz2014 opened this issue Aug 24, 2023 · 50 comments
Labels
enhancement New feature or request suggestion

Comments

@modz2014
Copy link

hi i notice the context menu is duplicted under show more options and the windows 11 context menu so if im on windows 11 it should only show up when i right click but not under show more options

@modz2014
Copy link
Author

i have made temporary fix to it

@MouriNaruto
Copy link
Member

It's not duplicated due to some third-party apps like Everything will show the classic context menu in their UI. But I think next version of NanaZip will try to add an option for achieve your idea.

Kenji Mouri

@MouriNaruto MouriNaruto added suggestion enhancement New feature or request labels Aug 29, 2023
@modz2014
Copy link
Author

any update on it don't mind helping

@modz2014
Copy link
Author

modz2014 commented Aug 30, 2023

I trust this contribution proves valuable to you.

bool IsWindows11OrLater()
    {
        OSVERSIONINFOEX osvi;
        ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
        osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
        osvi.dwBuildNumber = 22000; // Minimum build number for Windows 11
        DWORDLONG dwlConditionMask = 0;
        VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);

        return VerifyVersionInfo(&osvi, VER_BUILDNUMBER, dwlConditionMask);
    }



    IFACEMETHODIMP GetState(_In_opt_ IShellItemArray* selection, _In_ BOOL okToBeSlow, _Out_ EXPCMDSTATE* cmdState)
    {
        
     
        bool isWindows11OrLater = IsWindows11OrLater();

      
        if (isWindows11OrLater)
        {
            if (selection && okToBeSlow)
            {
                *cmdState = ECS_ENABLED;
                return S_OK;
            }
            *cmdState = ECS_HIDDEN; // Hides the classic context menu on Windows 11
        }
        else
        {
            // Handle other cases, if necessary.
            *cmdState = ECS_ENABLED; // Show the context menu item by default on other versions.
        }

        return S_OK;
    }

@MouriNaruto
Copy link
Member

@modz2014

I will try to integrate that in recent days.

Kenji Mouri

@modz2014
Copy link
Author

did you want me to create a pull request I don't mind

@MouriNaruto
Copy link
Member

did you want me to create a pull request I don't mind

I think I will make some modifications. So, I will make a git co-authored commit with you.

I hope you can provide me something like that:

Co-authored-by: NAME NAME@EXAMPLE.COM

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Aug 30, 2023

Co-authored-by: Modz2014 dawgz1992.jp@gmail.com
is this what you want sorry I'm a bit confused

@MouriNaruto
Copy link
Member

is this what you want sorry I'm a bit confused

It can help me to create a commit about those changes co-authored with you.

Kenji Mouri

@modz2014
Copy link
Author

Ok is that all you need

@modz2014
Copy link
Author

@MouriNaruto, I've also observed certain aspects of the user interface that require adjustments. As I await your guidance, I'd like to draw attention to the size of elements such as "Extract" and other options, which currently appear quite large. It would greatly enhance the visual harmony of the UI if we could resize these elements slightly, ensuring they maintain a reasonable size consistent with the file toolbar. This adjustment would not only improve aesthetics but also contribute to a cleaner overall appearance. Additionally, I'm contemplating the inclusion of an Inno Setup .ssi file, though its necessity is still under consideration. Your insights on this matter would be greatly appreciated.

@modz2014
Copy link
Author

modz2014 commented Sep 1, 2023

@MouriNaruto is there going to be new updates to this soon

@modz2014
Copy link
Author

modz2014 commented Sep 1, 2023

@MouriNaruto can i send you some archive formats to be added i tried to add them myself but the porject is all the place for me to understand i can email them to you

@MouriNaruto
Copy link
Member

can i send you some archive formats to be added i tried to add them myself but the porject is all the place for me to understand i can email them to you

Of course, you can.

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Sep 1, 2023

ok what is your email address

@MouriNaruto
Copy link
Member

ok what is your email address

KurikoMouri@outlook.jp

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Sep 1, 2023

@MouriNaruto i sent they now sorry i had to finish up

@modz2014
Copy link
Author

modz2014 commented Sep 2, 2023

@MouriNaruto I'm trying to add Inno Setup scripts, but it seems a lot harder are you working on adding this as well as other installer

@modz2014
Copy link
Author

modz2014 commented Sep 4, 2023

@MouriNaruto ill create a pull request with some changes in the next hour or something for you

@MouriNaruto
Copy link
Member

MouriNaruto commented Sep 30, 2023

I won't accept the suggestion and the PR of hiding NanaZip item in the legacy context menu because there is no proper way to implement.

Due to packaged shell extensions running out of process, we cannot check the process is File Explorer or third-party applications which need shell extensions. (For example, the common open and save dialog.)

Due to many people may like to select all files in the folder which the file count is large like the System32 folder, it's not suitable for using okToBeSlow to optimize.

Kenji Mouri

@modz2014
Copy link
Author

@MouriNaruto wait im confused do you mean about the context menu showing up the new windows 11 one stay hidden under show more options

@MouriNaruto
Copy link
Member

do you mean about the context menu showing up the new windows 11 one stay hidden under show more options

Yes, the common open and save dialog only uses the legacy context menu.

Kenji Mouri

@modz2014
Copy link
Author

can you screenshot to me because it works fine for me

@MouriNaruto
Copy link
Member

can you screenshot to me because it works fine for me

image

The simplest way to show what I said is using the Browse dialog when you use Windows Run dialog.

Kenji Mouri

@MouriNaruto
Copy link
Member

image

Also, when you open File Explorer via Windows Tools in the Start menu, you will always use legacy context menu.

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Oct 1, 2023

ok i added in checks for this it should work now I will update it later

@modz2014
Copy link
Author

modz2014 commented Oct 1, 2023

Untitled also works for browse under run as well

@modz2014
Copy link
Author

modz2014 commented Oct 1, 2023

@MouriNaruto hope this helps

IFACEMETHODIMP GetState(_In_opt_ IShellItemArray* selection, _In_ BOOL okToBeSlow, _Out_ EXPCMDSTATE* cmdState)
        {


            bool isWindows11OrLater = IsWindows11OrLater();


            if (isWindows11OrLater)
            {
                if (selection && okToBeSlow)
                {
                    *cmdState = ECS_ENABLED;
                    return S_OK;
                }
                *cmdState = ECS_HIDDEN;
            }
            if (IsActiveWindowDialog())
            {
                *cmdState = ECS_ENABLED;
            }
            else
            {
                *cmdState = ECS_HIDDEN; // Hides the classic context menu on Windows 11 for non-Save dialog scenarios
            }
           
       

            return S_OK;
        }

        bool IsDialog(const WCHAR* className)
        {
            return wcscmp(className, L"#32770") == 0;
        }`

@MouriNaruto
Copy link
Member

Sorry, it's not helpful for out-of-process shell extensions.

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Oct 1, 2023

@MouriNaruto Please explain

@MouriNaruto
Copy link
Member

MouriNaruto commented Oct 1, 2023

@MouriNaruto Please explain

Due to the out-of-process shell extension is hosted by comhost.exe, you cannot get the proper Window which is using the shell extension properly.

Also, your new code snippet is not complete. The cases which need legacy context menu not only the common file open and save dialog. You need to adapt for lots of third-party applications. I don't think it's good for adding lots of check for that.

Oh, I forgot something about some users may need to use right click with shift key to show the legacy context menu in File Explorer. So, this proposal is not suitable to implement.

Kenji Mouri

@MouriNaruto
Copy link
Member

MouriNaruto commented Oct 1, 2023

Also, following Microsoft's current behavior of built-in shell extensions which support Windows 11's modern style context menu (show the item in both modern one and legacy one), this is another reason of your proposal is not suitable to implement.

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Oct 2, 2023 via email

@modz2014
Copy link
Author

modz2014 commented Oct 2, 2023

@MouriNaruto i would have to rewrite the context menu and add 2 checks in source code

@modz2014
Copy link
Author

modz2014 commented Oct 3, 2023

Hey @MouriNaruto, I've embarked on enhancing the shell extension by transitioning it into a COM Shell Extension. Currently, this transformation is pivotal in overcoming various limitations, such as the recurrent appearance of duplicated context menus in both the new and old interfaces upon right-clicking. Additionally, I've identified and addressed the constraints on subcommands, eliminating any predefined limits and enhancing overall flexibility.

Admittedly, I encountered some complexity in deciphering certain portions of the code shared earlier, but I'm committed to resolving that in the upcoming days. If this development aligns with your interests, I would greatly appreciate your input and support. Let me know, and I'll continue the comprehensive rewrite of the entire codebase.

@MouriNaruto
Copy link
Member

MouriNaruto commented Oct 3, 2023

@modz2014

I've embarked on enhancing the shell extension by transitioning it into a COM Shell Extension. Currently, this transformation is pivotal in overcoming various limitations,

The current implementation is already COM-based. Also, the modern context menu in Windows 11 doesn't support old shell extension interfaces.

this development aligns with your interests

At least, the "the recurrent appearance of duplicated context menus in both the new and old interfaces upon right-clicking" does not align my interests. The reasons I have already noted before. (keep the same behavior from Microsoft and other third-party implementations, demand from users which needs the legacy menu experience and third-party application interoperability support, reduce check logics in the implementation)

Kenji Mouri

@MouriNaruto
Copy link
Member

Also, I don't think it's OK for me to merge your other implementations unless you split them to separate PRs. (I hope each PR has only one feature in the most cases.)

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Oct 3, 2023

so did you want me to create another pull request for an open extraction folder after extraction is completed?

@MouriNaruto
Copy link
Member

so did you want me to create another pull request for an open extraction folder after extraction is completed?

Yes, this is what I hope. Also, I think the modification should be done in NanaZipWindows project or NanaZipG.exe because the GUI extraction implementation is in that module.

Kenji Mouri

@MouriNaruto
Copy link
Member

About the context menu implementation, I think I will reduce the check logics and menu items for improving the performance.

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Oct 3, 2023

OK i will cancel the pull request and reupload them again and i was looking and Notepad++ duplicate of the context menu and they have resolved the issue so I might take a look at this

@MouriNaruto
Copy link
Member

OK i will cancel the pull request and reupload them again and i was looking and Notepad++ duplicate of the context menu and they have resolved the issue so I might take a look at this

They use separate COM interfaces for context menus shown in the modern one and the classic one. I don't think it's a good solution because I want to reduce the complexity. I think I will continue to research for the suggestion you requested. And I think I will set co-author-by with you if I commit this feature.

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Oct 3, 2023

ok no worries i making a commit for Enable Destination Option after extraction under the settings tab will do a pull request soon for it

@modz2014
Copy link
Author

modz2014 commented Oct 4, 2023

@MouriNaruto can you link to the extraction part please sorry just trying to work from my phone

@MouriNaruto
Copy link
Member

@MouriNaruto can you link to the extraction part please sorry just trying to work from my phone

Maybe you can find something from https://github.com/M2Team/NanaZip/tree/main/SevenZip/CPP/7zip/UI/GUI.

Kenji Mouri

@modz2014
Copy link
Author

modz2014 commented Oct 15, 2023

hey what has changed lately I'm back from my holiday today and just trying to figure out where I was @MouriNaruto

@modz2014
Copy link
Author

@MouriNaruto i cant see to find the context menu when you right click in NanaZip gui one a file

@modz2014
Copy link
Author

@MouriNaruto i havent not update NanaZip yet or anything

@toshiya14
Copy link

I appreciate you have support the new context menu for Windows 11. But actually most of the people hate the new context menu such as me.
I have patched my explorer to roll back classic context menu as default option. In this case, I could not use nanazip function anymore.
As I right click in the explorer, the context menu popped up is classic context menu, and no nanazip options inside.
I guess they might be added into the new context menu, but that menu already be skipped.
So, may I ask you to add an option to switch use classic context menu or new context menu for Windows 11.

Thanks so much.

@modz2014
Copy link
Author

its still has the old option as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request suggestion
Projects
None yet
Development

No branches or pull requests

3 participants