Programmer Reference : Common Graphics : Icons : Loading icons from DLLs
Loading icons from DLLs
On Windows, CgIcons can be loaded from an icon resource linked into the virtual machine (VM) executable or another file. A platform-specific resource specifier object is used to identify the icon resource.
On Windows, resource specifiers can be either strings (as in the previous example) or integers.
The following code illustrates how to load an icon resource from the VM executable on the Windows platform. Do this using the fromResource: class method:
| icon |
icon := CgIcon fromResource: 'APP_ICON'.
CgWindow default
drawIcon: CgGC default x: 0 y: 0 icon: icon.
icon freeIcon
To load an icon resource from a file other than the VM executable, use the fromResource:fileName: class method of CgIcon. The following examples load an icon from the VM executable, as above, but the file name is explicitly specified:
"Windows"
| icon |
icon := CgIcon
fromResource: 'APP_ICON' fileName: 'abt.exe'.
CgWindow default
drawIcon: CgGC default x: 0 y: 0 icon: icon.
icon freeIcon
 
Last modified date: 01/29/2015