[SHELL32] No new menu and working properties in Drives and NetHood background menu (#7430)

- No "New" menu in My Computer background menu.
- Add "Properties" in NetHood background menu.
This commit is contained in:
Whindmar Saksit 2024-10-31 14:12:34 +01:00 committed by GitHub
parent 92996dac21
commit 9cca5bf4b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 17 deletions

View file

@ -915,20 +915,7 @@ HRESULT WINAPI CDrivesFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVO
}
else if (IsEqualIID(riid, IID_IContextMenu))
{
HKEY hKeys[16];
UINT cKeys = 0;
AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
DEFCONTEXTMENU dcm;
dcm.hwnd = hwndOwner;
dcm.pcmcb = this;
dcm.pidlFolder = pidlRoot;
dcm.psf = this;
dcm.cidl = 0;
dcm.apidl = NULL;
dcm.cKeys = cKeys;
dcm.aKeys = hKeys;
dcm.punkAssociationInfo = NULL;
DEFCONTEXTMENU dcm = { hwndOwner, this, pidlRoot, this };
hr = SHCreateDefaultContextMenu(&dcm, riid, ppvOut);
}
else if (IsEqualIID(riid, IID_IShellView))
@ -1364,7 +1351,7 @@ HRESULT WINAPI CDrivesFolder::CallBack(IShellFolder *psf, HWND hwndOwner, IDataO
// "System" properties
return SHELL_ExecuteControlPanelCPL(hwndOwner, L"sysdm.cpl") ? S_OK : E_FAIL;
}
else if (uMsg == DFM_MERGECONTEXTMENU)
else if (uMsg == DFM_MERGECONTEXTMENU) // TODO: DFM_MERGECONTEXTMENU_BOTTOM
{
QCMINFO *pqcminfo = (QCMINFO *)lParam;
HMENU hpopup = CreatePopupMenu();

View file

@ -207,6 +207,33 @@ BOOL CNetFolderEnum::CreateMyCompEnumList(DWORD dwFlags)
return bRet;
}
/**************************************************************************
* CNetFolder background context menu
*/
static HRESULT CALLBACK CNetFolderBackgroundMenuCB(IShellFolder *psf, HWND hwnd, IDataObject *pdtobj,
UINT uMsg, WPARAM wParam, LPARAM lParam)
{
enum { IDC_PROPERTIES };
if (uMsg == DFM_INVOKECOMMAND && wParam == IDC_PROPERTIES)
{
return SHELL_ExecuteControlPanelCPL(hwnd, L"ncpa.cpl") ? S_OK : E_FAIL;
}
else if (uMsg == DFM_MERGECONTEXTMENU) // TODO: DFM_MERGECONTEXTMENU_BOTTOM
{
QCMINFO *pqcminfo = (QCMINFO*)lParam;
HMENU hpopup = CreatePopupMenu();
_InsertMenuItemW(hpopup, 0, TRUE, IDC_PROPERTIES, MFT_STRING, MAKEINTRESOURCEW(IDS_PROPERTIES), MFS_ENABLED);
pqcminfo->idCmdFirst = Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
DestroyMenu(hpopup);
return S_OK;
}
return SHELL32_DefaultContextMenuCallBack(psf, pdtobj, uMsg);
}
/**************************************************************************
* CNetFolder
*/
CNetFolder::CNetFolder()
{
pidlRoot = NULL;
@ -330,8 +357,8 @@ HRESULT WINAPI CNetFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID
}
else if (IsEqualIID(riid, IID_IContextMenu))
{
WARN("IContextMenu not implemented\n");
hr = E_NOTIMPL;
hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, 0, NULL, this, CNetFolderBackgroundMenuCB,
0, NULL, (IContextMenu**)ppvOut);
}
else if (IsEqualIID(riid, IID_IShellView))
{