Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the icon of a shortcut (shell link)

Status
Not open for further replies.

burgdavid

Programmer
Jun 22, 2000
70
DE
Hello,<br><br>this is probably a difficult problem.<br><br>I use a CListView to display files from the hard disk.<br><br>I have got a handle to the system small icon list using the following command :<br>hSystemImageList =<br> (HIMAGELIST)SHGetFileInfo(<br> (LPCTSTR)_T(&quot;C:\\&quot;),<br> 0,<br> &shfi, <br> sizeof(SHFILEINFO),<br> SHGFI_SYSICONINDEX ¦ SHGFI_SMALLICON);<br><br>Then I attach this list to my CListView through GetListCtrl().SetImageList(...)<br><br>Then, I can retrieve the position of the icon for a file with SHGetFileInfo :<br>int iIconIndex = SHGetFileInfo(<br> (LPCTSTR)csFileName, <br> 0,<br> &sfi,<br> sizeof(SHFILEINFO), <br> SHGFI_SYSICONINDEX ¦ SHGFI_SMALLICON );<br><br>where csFilename is a CString containing the path and name of the file. (I use callback with an OnGetDispInfo method)<br><br>This works fine with quite all files, execpt.. Execpt with shortcuts (also know as Shell Link, these files which names ends with &quot;.lnk&quot;) where the small arrow indicates normally the presence of a shortcut. But here the arrow is not present. SHGetFileInfo only retrieve the (good) icon index but without the arrow.<br>Does it exist a special icons list to retrieve to got this arrow ? Or (probably better), is it a way to draw / indicate to the CListView to draw an arrow on the icon ?<br><br>David.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top