ImageEn, unit iexBitmaps

TIOParams.IsResource

TIOParams.IsResource


Declaration

property IsResource: Boolean;


Description

Some formats (BMP, ICO, CUR) do not contain all headers when stored as resources (e.g. in EXE, DLL, etc...). If you set IsResource = true, ImageEn will skip loading of these headers so the image can be loaded correctly.

Default: False


Demo

Demo  Demos\InputOutput\ResourceLoader\ResourceLoader.dpr


Examples

// Extract the first icon in Windows Explorer
re := TIEResourceExtractor.Create('C:\Windows\Explorer.exe');
try
  buffer := re.GetBuffer( 'Icon', 'INTRESOURCE:1', bufferLen );
  ImageEnView1.IO.Params.IsResource := True;
  if ImageEnView1.IO.LoadFromBuffer( buffer, bufferLen ) then
    ImageEnView1.IO.SaveToFile( 'D:\Explorer.ico' );
finally
  re.Free;
end;




// Load resource 143 in "Bitmap" from current application
var
  re: TIEResourceExtractor;
  buffer: pointer;
  bufferLen: integer;
begin
  re := TIEResourceExtractor.Create( Application.ExeName );
  try
    buffer := re.GetBuffer('Bitmap', 'INTRESOURCE:143', bufferLen);
    ImageEnView1.IO.Params.IsResource := True;
    ImageEnView1.IO.LoadFromBuffer(buffer, bufferLen, ioBMP);
  finally
    re.Free;
  end;
end;