Context menu extensions
-
Hi All, I have implemented context menu extension on my Namespace Extension icon. I have added 4 menus in my QueryContextMenu function. This works fine in Windows 2k. But I am able to see only the first menu added by me when I test it on WinXP or on Win2k3. Also, explorer crashes when the user selects the "Create Shortcut" menu on win 2k. Can anyone tell me what may be going wrong here? Thanks and Regards, Anil
-
Hi All, I have implemented context menu extension on my Namespace Extension icon. I have added 4 menus in my QueryContextMenu function. This works fine in Windows 2k. But I am able to see only the first menu added by me when I test it on WinXP or on Win2k3. Also, explorer crashes when the user selects the "Create Shortcut" menu on win 2k. Can anyone tell me what may be going wrong here? Thanks and Regards, Anil
This is how I implemented my QueryCOntextMenu STDMETHODIMP MyShellFOlder::QueryContextMenu(HMENU hMenu, UINT uiIndexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) m_hMenu = hMenu; m_idCmdFirst = uiIndexMenu; m_id = idCmdFirst; if (CMF_DEFAULTONLY & uFlags) return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,0); int i = uiIndexMenu; MxSNECmdMgr cmdMgr; try { if(!cmdMgr.IsConnectedFromShell()) { MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; mii.wID = idCmdFirst + ID_CONNECT; mii.fType = MFT_STRING; mii.dwTypeData = _T("Connect"); mii.fState = MFS_ENABLED; bool b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii); mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; mii.wID = idCmdFirst + ID_SEARCH; mii.fType = MFT_STRING; mii.dwTypeData = _T("Search"); mii.fState = MFS_DISABLED; b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii); mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; mii.wID = idCmdFirst + ID_CREATEUSINGTEMPLATE; mii.fType = MFT_STRING; mii.dwTypeData = _T("Create Using Template"); mii.fState = MFS_DISABLED; b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii); mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; mii.wID = idCmdFirst + ID_DISCONNECT; mii.fType = MFT_STRING; mii.dwTypeData = _T("Disconnect"); mii.fState = MFS_DISABLED; b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii); mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; mii.wID = idCmdFirst + ID_ABOUT; mii.fType = MFT_STRING; mii.dwTypeData = _T("About"); mii.fState = MFS_ENABLED; b = InsertMenuItem(hMenu, uiIndexMenu++, TRUE, &mii); } catch(...) { } return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(i-uiIndexMenu)); }