NanaZip icon indicating copy to clipboard operation
NanaZip copied to clipboard

Context menu windows 11 duplicated

Open DevX-Cipher opened this issue 2 years ago • 50 comments

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

DevX-Cipher avatar Aug 24 '23 06:08 DevX-Cipher

i have made temporary fix to it

DevX-Cipher avatar Aug 29 '23 10:08 DevX-Cipher

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 avatar Aug 29 '23 10:08 MouriNaruto

any update on it don't mind helping

DevX-Cipher avatar Aug 29 '23 13:08 DevX-Cipher

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;
    }

DevX-Cipher avatar Aug 30 '23 12:08 DevX-Cipher

@modz2014

I will try to integrate that in recent days.

Kenji Mouri

MouriNaruto avatar Aug 30 '23 12:08 MouriNaruto

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

DevX-Cipher avatar Aug 30 '23 12:08 DevX-Cipher

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 [email protected]

Kenji Mouri

MouriNaruto avatar Aug 30 '23 13:08 MouriNaruto

Co-authored-by: Modz2014 [email protected] is this what you want sorry I'm a bit confused

DevX-Cipher avatar Aug 30 '23 14:08 DevX-Cipher

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

MouriNaruto avatar Aug 30 '23 14:08 MouriNaruto

Ok is that all you need

DevX-Cipher avatar Aug 30 '23 14:08 DevX-Cipher

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

DevX-Cipher avatar Aug 30 '23 15:08 DevX-Cipher

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

DevX-Cipher avatar Sep 01 '23 13:09 DevX-Cipher

@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

DevX-Cipher avatar Sep 01 '23 13:09 DevX-Cipher

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

MouriNaruto avatar Sep 01 '23 14:09 MouriNaruto

ok what is your email address

DevX-Cipher avatar Sep 01 '23 14:09 DevX-Cipher

ok what is your email address

[email protected]

Kenji Mouri

MouriNaruto avatar Sep 01 '23 15:09 MouriNaruto

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

DevX-Cipher avatar Sep 01 '23 16:09 DevX-Cipher

@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

DevX-Cipher avatar Sep 02 '23 05:09 DevX-Cipher

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

DevX-Cipher avatar Sep 04 '23 10:09 DevX-Cipher

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

MouriNaruto avatar Sep 30 '23 04:09 MouriNaruto

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

DevX-Cipher avatar Sep 30 '23 12:09 DevX-Cipher

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

MouriNaruto avatar Sep 30 '23 13:09 MouriNaruto

can you screenshot to me because it works fine for me

DevX-Cipher avatar Sep 30 '23 14:09 DevX-Cipher

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 avatar Sep 30 '23 16:09 MouriNaruto

image

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

Kenji Mouri

MouriNaruto avatar Sep 30 '23 16:09 MouriNaruto

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

DevX-Cipher avatar Oct 01 '23 11:10 DevX-Cipher

Untitled also works for browse under run as well

DevX-Cipher avatar Oct 01 '23 12:10 DevX-Cipher

@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;
        }`

DevX-Cipher avatar Oct 01 '23 12:10 DevX-Cipher

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

Kenji Mouri

MouriNaruto avatar Oct 01 '23 13:10 MouriNaruto

@MouriNaruto Please explain

DevX-Cipher avatar Oct 01 '23 13:10 DevX-Cipher