I want to show the Windows Explorer context menu.
I don't want to add my application to it, I just want to display it inside my application.
A good example of the implementation that I need is Total Commander.
If you press and hold right mouse button, TC will show the context menu, which is exactly the same as in Windows explorer.
I'm using C++/Qt, but language is not important here.
Right-click the newly created key, select the New menu and select the Key option. Name the key InprocServer32 and press Enter. Double-click the newly created key and set its value to blank to enable the classic context menu on Windows 11. Click the OK button.
Right-click in the right pane and create a new 32-Bit DWORD value and name it NoViewContextMenu. Giving it a value of 1 will disable the context menu in File Explorer. To re-enable context menu, give it a value 0 or delete NoViewContextMenu. Do remember to create a system restore point first!
To open the context menu, right-click (or press and hold) on a file or folder in File Explorer. To find commands from the previous Windows 10 context menu: Right-click (or press and hold) on a file or folder to open the context menu. Select Show more options.
I found several samples that may help you. You're not likely to be able to do this with Qt alone, since the shell context menu is highly OS-specific; probably some Win32 calls will be needed also.
A Raymond Chen blog series "How to host an IContextMenu"
And some non-C++ samples also:
And related SO questions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With