右键单击带有窗口外壳的资源管理器时如何获取链接名称

时间:2018-08-09 10:42:34

标签: c++ windows shell

我使用以下代码。我可以获取文件链接的文件名,但无法获取链接的名称。谁可以帮助我?

STDMETHODIMP CJhContextMenu::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT pdtobj, HKEY hkeyProgID)
{
  HRESULT hr;
  UINT nFileCount;
  UINT nLen,nLen1;

  m_bFail = FALSE;
  FORMATETC fmt = {CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
  STGMEDIUM sm = { TYMED_HGLOBAL };

  hr = pdtobj->GetData(&fmt, &sm);

  if (FAILED(hr))
  {
    m_bFail = TRUE;
    return hr;
  }
  nLen = DragQueryFileA((HDROP)sm.hGlobal, 0, szFileName, sizeof(char) * MAX_PATH);
}

0 个答案:

没有答案