TCHAR Temp[MAX_PATH] = { 0, };
HRESULT hr = NULL;
PIDLIST_ABSOLUTE pidl; //=LPITEMIDLIST
IShellItem2 *_psiDrop=NULL;
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); //must add this!
SHParseDisplayName(L"C:\\", NULL, &pidl, 0, NULL);
if (SHGetPathFromIDList(pidl, Temp))
{
wprintf(L"%s\n", Temp);
}
hr = SHCreateItemFromIDList(pidl, IID_PPV_ARGS(&_psiDrop));
if (FAILED(hr))
{
wprintf(L"SHCreateItemFromIDList failed");
}
如何初始化IShellItem2以使用PIDLIST_ABSOLUTE? _psiDrop已为NULL。