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.
Fri, 2022-09-30 16:40
#1
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.
Thanks Thomas.
Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner.
https://keasigmadelta.com/ - see more of my work