我正在构建一个关于filecontextmenu的dll,我需要在鼠标右键单击时获取执行路径和快捷方式displaynem。现在我可以获取路径,但不知道如何获取显示名称。EX:桌面中的IE快捷方式,我需要用户可以编辑的名称“IE”,而不是“iexplore.exe”。
这是一个非常相似的参考,但我找不到我应该做的,当桌面上的快捷方式
如果有任何建议我将不胜感激,这是我的代码,谢谢。
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;