How to get application icon associated with a file
-
:confused:Hi there, Kindly tell me how can we retrieve the icon associated with a file which is defined by the application used to build that file. Actually I've got a list of files which I want to display in a List Control along with the icon associated with it. Regards Gaurav Gaurav Gumber
-
:confused:Hi there, Kindly tell me how can we retrieve the icon associated with a file which is defined by the application used to build that file. Actually I've got a list of files which I want to display in a List Control along with the icon associated with it. Regards Gaurav Gaurav Gumber
How about
FindExecutable()
andExtractIcon()
? -
:confused:Hi there, Kindly tell me how can we retrieve the icon associated with a file which is defined by the application used to build that file. Actually I've got a list of files which I want to display in a List Control along with the icon associated with it. Regards Gaurav Gaurav Gumber
Here's a function I use:
HICON GetFileIconHandle(CString cstrFileName, BOOL bSmallIcon)
{
SHFILEINFO sfi;if (bSmallIcon) { SHGetFileInfo((LPCTSTR)cstrFileName, FILE\_ATTRIBUTE\_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI\_ICON | SHGFI\_SMALLICON | SHGFI\_USEFILEATTRIBUTES); } else { SHGetFileInfo((LPCTSTR)cstrFileName, FILE\_ATTRIBUTE\_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI\_ICON | SHGFI\_LARGEICON | SHGFI\_USEFILEATTRIBUTES); } return sfi.hIcon;
}
"I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it." - Jack Handey