DragDropHandlers IShellExtInit ::初始化和NETHOOD UNC路径

我下HKCR \文件夹\的shellex \ DragDropHandlers注册的外壳扩展,我需要在目标文件夹调用GetVolumePathName()+ GetVolumeInformation()(PIDL传递给你的IShellExtInit ::初始化)

问题是,当事情是在一个“NETHOOD捷径”(丢弃My Network Places\sharename )的PIDL传递给初始化指NETHOOD快捷方式,而不是UNC路径! (在PIDL调用SHGetPathFromIDList返回"%USERPROFILE%\NetHood\SHARE on MACHINE"而不是"\\MACHINE\SHARE"像你期望的那样)

我也尝试创建PIDL的的IShellItem并调用的IShellItem :: GetDisplayName各种SIGDN值,但他们没有返回的UNC路径。

我怎样才能从这个PIDL的UNC路径?

--------------解决方案-------------

// error checking omitted
IShellFolder* pFolder = NULL;
LPCITEMIDLIST pidlChild = NULL;
hr = SHBindToParent(pidl, IID_IShellFolder, (void**)&pFolder, &pidlChild);
SFGAOF Attributes = SFGAO_LINK;
hr = pFolder->GetAttributesOf(1, &pidlChild, &Attributes);
if(Attributes & SFGAO_LINK)
{
// item is a link; get it's target path
IShellLink* pLink = NULL;
hr = pFolder->GetUIObjectOf(NULL, 1, &pidlChild, IID_IShellLink, NULL, (void**)&pLink);
TCHAR szPath[MAX_PATH];
hr = pLink->GetPath(szPath, MAX_PATH, NULL, 0); // szPath now contains path of UNC share
pLink->Release();
pLink = NULL;
}
pFolder->Release();
pFolder = NULL;

分类:视窗 时间:2012-11-01 人气:0
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 3.477 (s). 10 q(s)