Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Menu items missing in shell context menu...

Menu items missing in shell context menu...

Scheduled Pinned Locked Moved C / C++ / MFC
linuxannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nm_114
    wrote on last edited by
    #1

    I'm trying to show the shell context menu for a file when only having the file name. I got the menu to come up but not all the menu items are showing up - like the ones virus scanners or zip utilities add to all files ("Scan File", "Add to Zip" etc.). Is there anything I'm missing:typedef HRESULT (WINAPI *lpfnSHBindToParent)(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast); LRESULT OnContextMenu(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { lpfnSHBindToParent pSHBindToParent = (lpfnSHBindToParent)GetProcAddress(GetModuleHandle(TEXT("SHELL32.DLL")), "SHBindToParent"); if (pSHBindToParent) { LPOLESTR pwszFileName; #ifdef UNICODE pwszFileName = strFullFileName; #else WCHAR wsz[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, strFullFileName, -1, wsz, ARRAYSIZE(wsz)); pwszFileName = wsz; #endif LPSHELLFOLDER pDesktopFolder; if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) { LPITEMIDLIST pidl; if (pDesktopFolder->ParseDisplayName(hMainWnd, NULL, pwszFileName, NULL, &pidl, NULL) == S_OK) { LPSHELLFOLDER pParentFolder; LPCITEMIDLIST pidlLast; if (pSHBindToParent(pidl, IID_IShellFolder, (void**)&pParentFolder, &pidlLast) == S_OK) { IContextMenu* picm; if (pParentFolder->GetUIObjectOf(hMainWnd, 1, &pidlLast, IID_IContextMenu, NULL, (void**)&picm) == S_OK) { HMENU hMenuPopup = CreatePopupMenu(); if (hMenuPopup) { if ( SUCCEEDED( picm->QueryContextMenu(hMenuPopup, 0, 1, 0x7fff, CMF_NORMAL) )) { // when menu is shown not all the menu items are there... } DestroyMenu(hMenuPopup); } picm->Release(); } pParentFolder->Release(); } CoTaskMemFree(pidl); } pDesktopFolder->Release(); } } return 0; }

    - thanks

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups