[Overview][Classes][Index] Reference for unit 'groupresource' (#fcl-res)

TGroupResource.SetCustomItemDataStream

Sets a custom stream as the underlying stream for ItemData

Declaration

Source position: groupresource.pp line 55

public procedure TGroupResource.SetCustomItemDataStream(

  aStream: TStream

);

Arguments

aStream

  

The custom stream to use as the underlying ItemData stream

Description

This method allows the user to use a custom stream as the underlying stream for ItemData. This is useful when you want a TGroupIconResource or TGroupCursorResource to be created from a ico or cur file for which you have a stream.

Sample code

This code creates a resource containing an icon

var
  aName : TResourceDesc;
  aRes : TGroupIconResource;
  aFile : TFileStream;
  Resources : TResources;
begin
  Resources:=TResources.Create;
  aName:=TResourceDesc.Create('MAINICON');
  aRes:=TGroupIconResource.Create(nil,aName); //type is always RT_GROUP_ICON
  aName.Free; //not needed anymore
  aFile:=TFileStream.Create('mainicon.ico',fmOpenRead or fmShareDenyNone);
  aRes.SetCustomItemDataStream(aFile);
  Resources.Add(aRes);
  Resources.WriteToFile('myresource.res');

  Resources.Free; //it destroys aRes as well.
  aFile.Free;
end;

See also

TGroupResource.ItemData

  

Resource data as an ICO/CUR stream

TGroupIconResource

  

Group icon resource type

TGroupCursorResource

  

Group cursor resource type

TAbstractResource.UpdateRawData

  

Updates RawData stream.


Documentation generated on: May 14 2021