为什么SHCreateItemFromIDList会失败?

时间:2016-07-28 08:17:38

标签: winapi visual-c++

    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。

0 个答案:

没有答案