
interesting question about displaying icons
heres a question that the more technically minded might enjoy! Within my
application, I am trying to display an icon that I have retrieved from an
exe file (from information I have retreived from the 'defaulticon' key in
the registry). I am using the ExtractIcon api, which returns me the handle
of the icon:
hIcon = ExtractIcon(App.hInstance, Mid(deficon, 1, findin - 1),
nIcon)
and then I am using the following code to display the icon in a picture box:
Set Picture2.Picture = LoadPicture("") ' Clear the picture box
Picture2.AutoRedraw = True
Call DrawIcon(Picture2.hdc, 0, 0, hIcon)
Picture2.AutoRedraw = False
Picture2.Refresh
Which is all very well - but what I want to do now is add the icon to an
imagelist so that it can be used in a treeview as the icon against the
node - which is a different (much smaller) image from within the icon file.
Im using a line like:
MDIForm1.ImageList1.ListImages.Add ,, , Picture2.Image
which adds the image in, but when I display it in the treeview its all
scrunched up and horribly distorted.
I think somehow i need to be able to identify the specific icon image (the
16x16 I guess) which I know exists in the icon within the application.
If anyones read this far, thanks for your perserverence - and for any help
thats forthcoming!
Regards
Adrian.