ImageEn, unit imageenio

TImageEnIO.LoadFromResource

TImageEnIO.LoadFromResource


Declaration

procedure LoadFromResource(const ModulePath: WideString; const ResourceType: String; const ResourceName: String; Format: TIOFileType = ioUnknown); overload;
procedure LoadFromResource(const ModulePath: WideString; const ResourceType: TIEResourceType; const ResourceIndex: Integer; Format: 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)
Format Specifies the expected file format. If Format is ioUnknown, then try to find the format automatically. ioUnknown should fail for BMP, ICO and CUR resources


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

LoadFromResource
LoadFromResource
TIEResourceExtractor