Retrieve icon from an exe file:
void GetProgramInfo(const CString& strProgramPath, SHFILEINFO* psfi)
{
if(psfi == NULL)
return;
ZeroMemory(psfi, sizeof(SHFILEINFO));
HIMAGELIST hImageList = (HIMAGELIST)SHGetFileInfo((LPCTSTR)strProgramPath, FILE_ATTRIBUTE_NORMAL,
psfi, sizeof(SHFILEINFO),SHGFI_SMALLICON SHGFI_SYSICONINDEX
SHGFI_DISPLAYNAME SHGFI_USEFILEATTRIBUTES);
if(psfi->iIcon != 0)
psfi->hIcon = ImageList_GetIcon(hImageList, psfi->iIcon, ILD_NORMAL);
}
Wednesday, September 16, 2009
Retrieve icon from an exe file
Insert Item in tree without image
HTREEITEM treeItemRoot = m_treePrograms.InsertItem(_T("ROOT"), -2, -2); // I_IMAGENONE
Subscribe to:
Posts (Atom)