System.Classes.TResourceStream.CreateFromID

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

constructor CreateFromID(Instance: THandle; ResID: Integer; ResType: PChar);

Properties

Type Visibility Source Unit Parent
constructor public System.Classes.pas System.Classes TResourceStream

Description

Creates an instance of TResourceStream associated with a particular resource ID and type.

Call CreateFromID to instantiate a TResourceStream for a resource in the indicated instance that can be identified by an integer ID. Create finds the resource data and loads it into the Memory buffer for the TResourceStream.

The Instance parameter is the instance handle associated with the executable or shared library that contains the resource.

The ResID is the integer ID associated with the resource in the .rc file that was compiled with the application. If the Resource was identified by a string rather than an ID number, use the Create method instead.

The ResType parameter is a string identifying the type of the resource. Applications can define their own resource types and identify them by name in the .rc file. In addition, there are a number of predefined resource types (which reflect Windows resource types). To identify a resource that is one of the predefined resource types, set ResType to the appropriate value from the following table:



ResType Type of resource

RT_ACCELERATOR

Accelerator table

RT_BITMAP

Bitmap resource

RT_DIALOG

Dialog box

RT_FONT

Font resource

RT_FONTDIR

Font directory resource

RT_MENU

Menu resource

RT_RCDATA

Application-defined resource (raw data)

RT_STRING

String-table entry

RT_MESSAGETABLE

Message-table entry

RT_CURSOR

Hardware-dependent cursor resource

RT_GROUP_CURSOR

Hardware-independent cursor resource

RT_ICON

Hardware-dependent icon resource

RT_GROUP_ICON

Hardware-independent icon resource

RT_VERSION

Version resource



Note: Specifying resources by ID requires less memory than specifying resources by name.

See Also