Retrieve embedded icon filename?

Windows specific forum
User avatar
chi
Addict
Addict
Posts: 1087
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Retrieve embedded icon filename?

Post by chi »

With GetClassLongPtr_(hWnd, #GCL_HICON) I get the handle of the associated icon from my app... But is it possible to retrieve the original filename too? (e.g. MyIcon.ico)

Thanks in advance ;)
Et cetera is my worst enemy
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Retrieve embedded icon filename?

Post by netmaestro »

Not sure whether you mean any program or a PB-compiled program. I have many PB-compiled programs and I loaded one of them in a hex editor and searched for the filename of the icon the compiler was set to use when it generated the exe. Not found. So you probably can't retrieve that information from the compiled exe. The compiler would have to deliberately store it and I guess it just doesn't.
BERESHEIT
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Retrieve embedded icon filename?

Post by Shield »

Icons on Windows are stored in a resource section and are referenced by ID / index and not by filename.
The "filename" of the icon is basically the filename of the executable itself, so I doubt that there is a way
to retrieve it.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
chi
Addict
Addict
Posts: 1087
Joined: Sat May 05, 2007 5:31 pm
Location: Austria

Re: Retrieve embedded icon filename?

Post by chi »

Thanks to both of you for your explanations! I already searched a few files with a hex editor but couldn't find anything related to the icon name. I was hoping that there's a magic function somewhere I don't know. Guess I have to stick with "App.ico" as description ;)
Et cetera is my worst enemy
Post Reply