Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Trying to get the icon of a system files, searched the and the function that everyone is using is :

 

 Private Declare Function SHGetFileInfo Lib "shell32.dll" Alias "SHGetFileInfoA" ( _
   ByVal pszPath As String, _
   ByVal dwFileAttributes As Integer, _
   ByRef psfi As SHFILEINFO, _
   ByVal cbFileInfo As Integer, _
   ByVal uFlags As Integer) As Integer

 

However, this function does not return icons for folders, and doesn't show the transparencies of icons.

 

Can anyone please help me with returning a correct icon from file / folders.

 

(p.s. i'm trying to fill a listview control with files & thier icons)

 

Thanks

  • Leaders
Posted

Have you tried...

Private Declare Function ExtractAssociatedIcon Lib "shell32.dll" _
 Alias "ExtractAssociatedIconA"
 (hInst As IntPtr, lpIconPath As String, lpiIcon As Integer) As IntPtr

You can use System.Drawing.Icon.FromHandle to convert the return value into a .Net Icon.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...