How to get the deficon for a file?

3 posts / 0 new
Last post
Hans
Hans's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2010-12-09 22:04
How to get the deficon for a file?

As the title says: how can a program get the deficon for a file? I thought the icon.library might have a function for it, but didn't see it in the AutoDocs.

thomas
thomas's picture
Offline
Last seen: 1 week 5 days ago
Joined: 2011-05-16 14:23
Re: How to get the deficon for a file?

GetIconTags with FailIfUnavailable set to FALSE will load the def icon of a file. Or just GetDiskObjectNew. So to save a file with its appropiate icon, you first save the file, then do
icon = GetIconTags(filename, ICONGETA_FailIfUnavailable, FALSE);
PutDiskObject(filename, icon);

GetIconTags also allows you to open a default icon of a given type, given by name.

There is no API to get the type of a file, though. This is not part of icon.library, it is done by DefIcons externally. In order to get such an API one would have to externalize the mechanism into a deficons.library which is then used by DefIcons and is available to app developers, too.

Hans
Hans's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2010-12-09 22:04
Re: How to get the deficon for a file?

Thanks Thomas.

Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work

Log in or register to post comments