이 함수는 일반 폴더 경로를 PIDL로 변환해준다.
HRESULT SHPathToPidl(LPCTSTR szPath, LPITEMIDLIST* ppidl) { LPSHELLFOLDER pShellFolder = NULL; OLECHAR wszPath[MAX_PATH] = {0}; ULONG nCharParesd = 0;
HRESULT hr = SHGetDesktopFolder(&pShellFolder); if(FAILED(hr)) return hr;
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, -1, wszPath, MAX_PATH); hr = pShellFolder->ParseDisplayName(NULL, NULL, wszPath, &nCharParesd, ppidl, NULL); pShellFolder->Release();
return hr; } |