q1w2e3r4t7 Posted May 28, 2006 Posted May 28, 2006 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 Quote
Leaders snarfblam Posted May 28, 2006 Leaders Posted May 28, 2006 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. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.