I need to search the entire Windows Control Panel for a string (just like windows search from start menu or control panel explorer) in C++ MFC, anyone could help me?
I've already tried to search within the control panel virtual folder but doesn't work...
EDIT: It Works NOW! but only if compliled to the proper plataform (x86 or x64) (x86 dosen't work on x64 SO)
void CSearchView::BuildControlPanelCache()
{
CComPtr<IShellFolder> pDesktop;
SHGetDesktopFolder(&pDesktop);
PIDLIST_ABSOLUTE path;
SHGetKnownFolderIDList(FOLDERID_ControlPanelFolder,0,NULL,&path);
CComPtr<IShellFolder> pFolder;
pDesktop->BindToObject(path,NULL,IID_IShellFolder,(void**)&pFolder);
ILFree(path);
CComPtr<IEnumIDList> pEnum;
if (pFolder->EnumObjects(NULL,SHCONTF_NONFOLDERS|SHCONTF_FOLDERS,&pEnum)!=S_OK) pEnum=NULL;
if (!pEnum) return;
PITEMID_CHILD pidl;
while (pEnum->Next(1,&pidl,NULL)==S_OK)
{
STRRET strDispName;
if( pFolder->GetDisplayNameOf(pidl, SHGDN_NORMAL, &strDispName) == S_OK )
{
CComPtr<IQueryInfo> pLink;
if (SUCCEEDED(pFolder->GetUIObjectOf(NULL,1,(PCITEMID_CHILD*) &pidl,IID_IQueryInfo,NULL,(void**)&pLink)))
{
TCHAR *pwszTip;
pLink->GetInfoTip( 0, &pwszTip );
if ( pwszTip )
{
SHFree( pwszTip );
}
//pLink->Release();
}
}
ILFree(pidl);
}
}
It seems to do the trick! Ty Guys!