TImageEnIO.LoadFromResource
Declaration
procedure LoadFromResource(const ModulePath: WideString; const ResourceType: string; const ResourceName: string; FileType: TIOFileType = ioUnknown); overload;
procedure LoadFromResource(const ModulePath: WideString; const ResourceType: TIEResourceType; const ResourceIndex: Integer; FileType: TIOFileType = ioUnknown); overload;
Description
Loads the specified image resource from PE files like EXE, DLL, OCX, ICL, BPL, etc.
| Parameter | Description |
| ModulePath | Specifies the path and filename of PE module |
| ResourceType | Resource type as string, e.g. 'Bitmap', 'Cursor' or 'RCData' (Case-insensitive) |
| ResourceName | Resource name as string, e.g. 'INTRESOURCE:100' or 'Hand' (Case-insensitive) |
| FileType | Specifies the file format of the image. If ioUnknown is specified, the format is detected automatically by reading the image header. ioUnknown cannot be used for BMP, ICO and CUR resources (as the format cannot be determined automatically) |
Note:
◼Resources of images are usually: ietrBitmap, ietrCursor, ietrIcon, ietrRCData
◼ietrCursor and ietrGroupCursor will usually return the same resources, as will ietrGroupIcon and ietrIcon
Example
// Load resource 143, of type "Bitmap", from "explorer.exe" (should be a small Windows logo)
ImageEnView1.IO.LoadFromResource('explorer.exe', 'Bitmap', 'INTRESOURCE:143', ioBMP);
// Load a PNG resource in the current EXE that have been defined in a resource file as follows:
// MYLOGO RCDATA "Logo.png"
ImageEnView1.IO.LoadFromResource( Application.ExeName, 'RCDATA', 'MYLOGO', ioPNG );
// Load the 5th resource of type "RCData" from current application
ImageEnView1.IO.LoadFromResource( Application.ExeName, ietrRCData, 5 );
See Also
◼TIEBitmap.LoadFromResource
◼TIEMultiBitmapHelper.LoadFromResource
◼TIEResourceExtractor