How to get the deficon for a file?

3 posts / 0 new
Last post
Hans
Hans's picture
Offline
Last seen: 1 day 1 hour 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: 15 hours 28 min 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: 1 day 1 hour ago
Joined: 2010-12-09 22:04
Re: How to get the deficon for a file?

Thanks Thomas.

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more. Home of the RadeonHD driver for Amiga OS 4.x project. http://keasigmadelta.co.nz/ - more of my software.
Log in or register to post comments