I lock the dll on filecontextmenu, I need to get the execution path and displaynem shortcut when right click. Now I can get the path, but I donβt know how to get the display name. EX: IE Shortcut on the desktop, I need the name "IE", which the user can edit, not "iexplore.exe".
here the link is very similar, but I canβt find out what to do when the desktop shortcut
If there is any suggestion that I really appreciate, here is my code and thanks.
IFACEMETHODIMP FileContextMenuExt::Initialize( LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID) if (NULL == pDataObj) return E_INVALIDARG; HRESULT hr = E_FAIL; FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; STGMEDIUM stm; // The pDataObj pointer contains the objects being acted upon. In this // example, we get an HDROP handle for enumerating the selected files and // folders. if (SUCCEEDED(pDataObj->GetData(&fe, &stm))) { // Get an HDROP handle. HDROP hDrop = static_cast<HDROP>(GlobalLock(stm.hGlobal)); if (hDrop != NULL) { UINT nFiles = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0); if (nFiles > 0) { vecSelectFiles.clear(); std::vector<std::wstring> vecTotalFiles; vecTotalFiles.clear(); for(int i=0; i<(int)nFiles; ++i) { wchar_t wszThisFile[MAX_PATH]; memset(wszThisFile, 0, MAX_PATH*2); // Here get excution path if(DragQueryFileW(hDrop, i, wszThisFile, MAX_PATH) != 0) { vecTotalFiles.push_back(wszThisFile); hr = S_OK; } } } GlobalUnlock(stm.hGlobal); } ReleaseStgMedium(&stm); } // If any value other than S_OK is returned from the method, the context // menu item is not displayed. return hr;
source share