You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
On Vista duplicated Git menu entries are added when you right-click a folder in the Folders pane
This is because the Shell calls the handler for the Directory\Background progid first (with a folder pidl), then calls it again for the other entries with a data object. So the trick is to check if the Git menu has already been written.
One way you can do this is by using InsertMenuItem on all menu entries and adding a unique identifier (your module handle, for example) to the dwItemData member of the item structure.
MENUITEMINFO mii = { sizeof(mii) };
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STRING | MIIM_ID | MIIM_DATA; // add MIIM_SUBMENU for a sub menu
mii.dwItemData = (ULONG_PTR) hInstance;
...
InsertMenuItem(hMenu, menuIndex, TRUE, &mii)
Then in the QueryContextMenu function you can check if any menu item has this value and act accordingly:
MENUITEMINFO mii = { sizeof(mii) };
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_DATA;
// get the number of existing menu entries
int count = GetMenuItemCount(hMenu);
for (int i = 0; i < count; ++i)
{
// get the item data
GetMenuItemInfo(hMenu, i, TRUE, &mii);
if (mii.dwItemData == (ULONG_PTR) hInstance)
{
// menu already written
return S_OK;
}
}
// menu not written
...
I had the same problem in an extension I was working on, and solved it with this solution.
The text was updated successfully, but these errors were encountered:
That looks like half a pull request to me! Well done! How about going the full nine yards and make it a proper pull request? Then you'd get eternal fame by being in the elite list of contributors... ;-)
On Vista duplicated Git menu entries are added when you right-click a folder in the Folders pane
![git-cheetah](https://camo.githubusercontent.com/b48f5d5ed8c30bcacaeb9d6c904d23f1f31ef848afb153c263f8549f15984cb7/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f3838313737372f313435333437352f33666366343237342d343266342d313165332d386136612d6531623364623866656431382e6a7067)
This is because the Shell calls the handler for the Directory\Background progid first (with a folder pidl), then calls it again for the other entries with a data object. So the trick is to check if the Git menu has already been written.
One way you can do this is by using
InsertMenuItem
on all menu entries and adding a unique identifier (your module handle, for example) to thedwItemData
member of the item structure.Then in the QueryContextMenu function you can check if any menu item has this value and act accordingly:
I had the same problem in an extension I was working on, and solved it with this solution.
The text was updated successfully, but these errors were encountered: