mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHELL32] Fix separator not showing for CopyTo and MoveTo menu
Fix wrong previous item index.
This commit is contained in:
parent
d4ca55f65e
commit
a706f6ba78
1 changed files with 17 additions and 2 deletions
|
@ -257,6 +257,21 @@ HRESULT CCopyMoveToMenu::DoAction(LPCMINVOKECOMMANDINFO lpici)
|
|||
return hr;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
GetPreviousMenuItemInfo(HMENU hMenu, UINT iItem, LPMENUITEMINFOW lpmii)
|
||||
{
|
||||
BOOL bSuccess = FALSE;
|
||||
|
||||
while (iItem > 0)
|
||||
{
|
||||
bSuccess = GetMenuItemInfoW(hMenu, --iItem, TRUE, lpmii);
|
||||
if (bSuccess || (!bSuccess && GetLastError() != ERROR_MENU_ITEM_NOT_FOUND))
|
||||
break;
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
CCopyToMenu::QueryContextMenu(HMENU hMenu,
|
||||
UINT indexMenu,
|
||||
|
@ -279,7 +294,7 @@ CCopyToMenu::QueryContextMenu(HMENU hMenu,
|
|||
ZeroMemory(&mii, sizeof(mii));
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_TYPE;
|
||||
if (GetMenuItemInfoW(hMenu, indexMenu - 1, TRUE, &mii) &&
|
||||
if (GetPreviousMenuItemInfo(hMenu, indexMenu, &mii) &&
|
||||
mii.fType != MFT_SEPARATOR)
|
||||
{
|
||||
ZeroMemory(&mii, sizeof(mii));
|
||||
|
@ -338,7 +353,7 @@ CMoveToMenu::QueryContextMenu(HMENU hMenu,
|
|||
mii.fMask = MIIM_TYPE;
|
||||
mii.dwTypeData = szBuff;
|
||||
mii.cch = _countof(szBuff);
|
||||
if (GetMenuItemInfoW(hMenu, indexMenu - 1, TRUE, &mii) &&
|
||||
if (GetPreviousMenuItemInfo(hMenu, indexMenu, &mii) &&
|
||||
mii.fType != MFT_SEPARATOR &&
|
||||
!(mii.fType == MFT_STRING && CStringW(szBuff) == strCopyTo))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue