Next NewBee question (Icons and TreeView)
-
Friday, May 13, 2005 3:20 PM
I am working with a treeview control and I want to be able to display the icons next to each node depending on the file type.
First I want to say that I am not working with a Windows File System files. I am working on files that are referenced through a proprietary file system that enables the revision history’s and other file attributes. It is for a Engineering software similar to Solidworks.Anyway my first problem is extracting the Icons from the dll.
I can’t seem to figure out how to do that I have been searching the net for 3 days and none of the code I find seems to work.
Dim lIcon As Long
lIcon = ExtractIcon(0&, <path>, 109)
Call DrawIcon(Picture1.Handle, 0, 0, lIcon)
Call DestroyIcon(lIcon)
Can someone at least point my in the right direction? I haven’t even started trying to display an icon in the Treeview yet. I would appreciate a little help in that area too.
Thanks in Advance
Clint
All Replies
-
Friday, May 13, 2005 5:40 PMModeratorWhat dll are you trying to get the icons from?
Is it a .NET assembly (ie VB.NET)? -
Monday, May 16, 2005 3:52 PMIt is an ActiveX dll. From a third party. I know that the Icons are there I have viewied them with an icon grabber.
Clint -
Monday, May 16, 2005 4:07 PMModerator
Try this code which I changed from here:
Public Function GetIcon() As Icon
Dim instance As IntPtr = Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0))
Dim hIcon As IntPtr = ExtractIcon(instance, "shell32.dll", 10)If Not hIcon.Equals(IntPtr.Zero) Then
Return Icon.FromHandle(hIcon)
End IfReturn Nothing
End Function
-
Monday, May 16, 2005 8:57 PMThanks, I will give that a shot.

