VC一点通:实现文件夹的缩略图显示
2008-11-14 19:36:31 来源:WEB开发网
voidCPicViewView::GetItemInfo(LPCITEMIDLISTpidl,CFolderItemInfo*pItemInfo)
{
HRESULThr=theApp.SHGetDisplayNameOf(pidl,pItemInfo->tszDisplayName);
IShellIcon*pShellIcon=NULL;
hr=m_psfFolder->QueryInterface(IID_IShellIcon,(LPVOID*)&pShellIcon);
if(SUCCEEDED(hr)&&pShellIcon){
pShellIcon->GetIconOf(pidl,0,&pItemInfo->iIcon);
pShellIcon->Release();
}
IShellIconOverlay*pShellIconOverlay=NULL;
hr=m_psfFolder->QueryInterface(IID_IShellIconOverlay,(LPVOID*)&pShellIconOverlay);
if(SUCCEEDED(hr)&&pShellIconOverlay){
intnOverlay=0;
pShellIconOverlay->GetOverlayIndex(pidl,&nOverlay);
pItemInfo->state=INDEXTOOVERLAYMASK(nOverlay);
pShellIconOverlay->Release();
}
LPITEMIDLISTpidlItemFull=ILCombine(m_pidlFolder,pidl);
if(pidlItemFull){
if(SHGetPathFromIDList(pidlItemFull,pItemInfo->tszPath)){
USES_CONVERSION;
hr=OleLoadPicturePath(
T2OLE(pItemInfo->tszPath)
,NULL,0,RGB(255,255,255)
,IID_IPicture,(LPVOID*)&pItemInfo->pic.m_pPict);
if(FAILED(hr)){
pItemInfo->bFailLoadPic=TRUE;
TRACE("OleLoadPicturePathfailed%srn",pItemInfo->tszPath);
}
}
}
m_pMalloc->Free(pidlItemFull);
}
}
更多精彩
赞助商链接