-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[EXPLORER] Don't use Explorers ID_SHELL_CMD IDs in IShellFolder menu #6872
[EXPLORER] Don't use Explorers ID_SHELL_CMD IDs in IShellFolder menu #6872
Conversation
Explorer does not control the IDs used by CFSFolder::QueryContext menu and therefore cannot share its ID range with it. The range passed to CFSFolder::QueryContext also cannot start at 0 because CTrayWindow::TrackCtxMenu would interpret that as user cancel.
This commit changed the meaning of ID_SHELL_CMD causing the ranges to overlap. I don't want to go back to the way it was because that means changes to the Explorer bands. Isolating the IDs for IShellFolder seems to be the best option. |
@whindsaks Do you think that the commit you mentioned was trying to be more correct than what was existing prior to it, but didn't go all the way there? |
I think the previous change simply forgot that startctxmnu.cpp was also using the same ID range. I'm not going to speculate on what is more correct, I can only point out the two common ways ROS gets IContextMenu wrong:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks OK; I just have a minor question about a code block.
return S_OK; | ||
if (idCmdLast - idCmdFirst >= ID_SHELL_CMD_LAST - ID_SHELL_CMD_FIRST) | ||
{ | ||
AddStartContextMenuItems(hPopup); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this code block be run even if the CreateContextMenuFromShellFolderPidl() call from above failed (or wasn't executed because either pidlStart was NULL or some of the if-tests failed) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you would then end up with a menu that just has Properties, Separator, Open/Explore All Users.
Explorer does not control the IDs used by the CFSFolder::QueryContext menu and therefore cannot share its ID range with it. The range passed to CFSFolder::QueryContext also cannot start at 0 because CTrayWindow::TrackCtxMenu would interpret that as user cancel.
Note: IDs clashing is configuration specific, it depends on the shell extensions you have installed that adds its items to folders.