To load icons from a file, send loadFromFileHandle:atOffset: or loadFromFile: to an instance of the appropriate subclass of CgIconFileFormat. Because the icon file formats allow more than one icon to be stored in a file, these methods answer an array of CgIcon objects if the file was successfully loaded, rather than a single CgIcon object. As with the image file formats, nil is answered if an error occurred. The following example illustrates how to load the icons from a Windows ICO file named my-icons.ico. Only the first icon is answered.
| format icons | format := CgWinICOFileFormat new. icons := format loadFromFile: 'my-icons.ico'. format hasErrorOccurred ifTrue: [self error: format currentErrorString]. ^icons first