I am trying to filter
result, by following instructions from this
Although links from the highest voted answer are invalid, I was able to find them and apply Mr.Chen's code in my own. Everything worked fine for Recycle Bin, it was filtered out, but Control Panel stayed.
Below is the example code, with relevant comments. All I have changed was the constant
, everything else was the same.
HRESULT CShellTree::EnumObjects(HTREEITEM hParentItem, LPSHELLFOLDER pParentFolder, LPITEMIDLIST pidlParent)
LPENUMIDLIST pEnum = NULL;
HRESULT hr = pParentFolder->EnumObjects(NULL, m_dwFlags, &pEnum);
if (FAILED(hr) || pEnum == NULL)
DWORD dwFetched = 1;
while (SUCCEEDED(pEnum->Next(1, &pidlTemp, &dwFetched)) && dwFetched)
bool skip = false;
hr = SHBindToParent(pidlTemp, IID_IShellFolder, (void**)&psf, &pidlChild);
hr = SHGetDataFromIDList(psf, pidlChild, SHGDFIL_DESCRIPTIONID, &pdid, sizeof(pdid));
skip = pdid.clsid == CLSID_ControlPanel;
I am supporting Windows 8 onward, using VS 2019. For further info leave a comment.
How to make above CLSID comparison work? Where is the correct CLSID constant?
What I have tried:
Going through the Debugger, I saw that
has the value
but code returns
, which is why comparison fails.
I have F12
hoping to find correct constant for Control Panel, but had no luck.
I have also looked here
], but again had no success.
I have found this link
] but can not yet see how will this info help me.
I am currently going through this SO question
] as it seems relevant...