How to check if Folder is a Special Shell Folder ?
Answer / Aman Rathi
To check if a folder is a special shell folder in Win32API code, you can use the IShellFolder interface's ParseDisplayName function. Here's an example:n`nSTDMETHODIMP CMyFolder::ParseDisplayName(IPersistFile* pPersistFile, LPOLESTR *ppnameOut, IMONIKER **ppMk, IBindCtx **ppbc)n{nIUnknown *pUnk = nullptr;nIShellFolder *pShellFolder = nullptr;nHRESULT hr = S_OK;nnhr = pPersistFile->Load(ppnameOut, STGM_READ | STGM_DELAYED_WRITE);nif (SUCCEEDED(hr)) {nhr = CoCreateInstance(CLSID_ShellFolder, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pUnk));nif (SUCCEEDED(hr)) {nIShellDispatch *pShellDispatch;nh = pUnk->QueryInterface(IID_PPV_ARGS(&pShellDispatch));nif (SUCCEEDED(hr)) {nIFolder *pFolder;nhr = pShellDispatch->GetParent((OLECHAR**)&ppnameOut, &pFolder);nif (SUCCEEDED(hr)) {nhr = pFolder->QueryInterface(IID_IShellFolder, (void **)&pShellFolder);npFolder.Release();n}n}n}n}nIFolder *pSpecialFolder;nh = pShellFolder->ParseDisplayName(pbc, NULL, ppnameOut, &pSpecialFolder);nIFCObject::Release(pUnk);nIFCObject::Release(pShellFolder);npSpecialFolder.Release();nrtruntime_assert(SUCCEEDED(hr));nreturn hr;n};n`
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the functionality of FindWindow?
How to Check if Folder Exists?
What is the functionality of SendMessage?
How to check if Folder is a Special Shell Folder ?
How to Get File Extension?
What is the functionality of SetForegroundWindow?
What is the functionality of EnumChildWindows?
What is GUID anyway?
What is the functionality of GetDesktopWindow?
What is the functionality of GetWindowText?
What is the functionality of EnumWindows?
What is the functionality of GetWindow?