HRESULT OpenFolderAndSelectItem(IShellItem *psi) { PIDLIST_ABSOLUTE pidl; HRESULT hr = SHGetIDListFromObject(psi, &pidl); if (SUCCEEDED(hr)) { hr = SHOpenFolderAndSelectItems(pidl, 0, NULL, 0); CoTaskMemFree(pidl); } return hr; }
HRESULT WINAPI SHGetItemFromObject(IUnknown *punk, REFIID riid, void **ppv) { LPITEMIDLIST pidl; HRESULT ret; ret = SHGetIDListFromObject(punk, &pidl); if(SUCCEEDED(ret)) { ret = SHCreateItemFromIDList(pidl, riid, ppv); ILFree(pidl); } return ret; }
CItemIterator(IShellItem *psi) : _hr(SHGetIDListFromObject(psi, &_pidlFull)), _psfCur(NULL) { _Init(); }