How show program/dll icon?

sitajony

Active Member
Licensed User
Hi, I know that this question has already was ask but I don't find the answer...
I would know if it's possible to extract or just show a program icon and a dll icon like a file explorer...
Thanks for your replies and sorry for this question already asked...

Edit: (On device).

Now I can get icon but can't show it without convert the icon to bitmap format... How can I do it? Anyone have a source code or other?

Edit:
Found! I can now convert any icon to bitmap just in drawing ico on bitmap :)

Now I've a problem again:
obj.Value=Obj.RunMethod2("ExtractAssociatedIcon","\Windows\fexplore.exe", "System.String")
It doesn't work on my device, it return "NullReferenceException"... Where is the problem?
Thanks for your replies!

Edit:
I saw that it's not available for Device... I'm searching an other way...
 
Last edited:

sitajony

Active Member
Licensed User
If the converting ico to bitmap doesn't exist yet I can make a library for this... I used ControlEx by Andrew but the converting is available only for Desktop... Maybe it'll be usefull if I build a library for Device...

With My lib we can open an ico file and convert it to bitmap or use an icon image and convert to bitmap for show it on Picturebox/ImageButton... It work really good on my device (LG KS20)...

Maybe andrew have already build a lib for this but I don't viewed...
I'll Upload my lib in few minutes ;)

But now I'm searching how use an icon ressource from an executable/Dll... If I find it I upload in same time the Lib ;)
 

sitajony

Active Member
Licensed User
I've some problem...:
ico.New2
ico.GetIcon0(TextBox1.Text,
True)
Image1.Image=ico.ToBitmap

It return object reference not set to an instance of an object... Why? (Line 3)...
Image1 exist and ico is an Icon class...

Edit: I found (I think) I fact GetIcon0 return an icon...
 
Last edited:

sitajony

Active Member
Licensed User
It work it's great :) But I've a new request... Is it possible to use an other icon ressource from a Dll/Exe?
 

sitajony

Active Member
Licensed User
try

ico.New2
ico.Value = ico.GetIcon0(TextBox1.Text,True)
Image1.Image=ico.ToBitmap
Yes I know, I saw that GetIcon0 return an icon and doesn't set an icon...
It work now... But is it possible to get an other icon ressource and not just the principal ressource icon?
 

agraham

Expert
Licensed User
Longtime User
But is it possible to get an other icon ressource and not just the principal ressource icon?
Not easily on a device as far as I know. The ExtractIconEx Win32 API function used by the library returns the default icon on a device easily but needs a resource identifier for any others which I don't know how to obtain. :(
 

sitajony

Active Member
Licensed User
You use the Handle for get the default icon :) It's surely possible to get the icons ressource but how... I'll search and If I find I'll tell you ;)
Thanks for your help about the default icon, it's usefull ;) I'm trying to build a small modern FileExplorer with wallpaper customisable, customisable folder etc...
 

sitajony

Active Member
Licensed User
I tested, yes we need the ressource ID and it Work... We'll could write a boucle by example from 0 to -1000 and show all icons who exists like TotalCommander CE I think, it return some icons only...
Thanks again for your help I'm really impressed by your job ;)
 
Top