RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TResourceStream.Create Constructor

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

Pascal
constructor Create(Instance: THandle; const ResName: string; ResType: PChar);
C++
__fastcall TResourceStream(THandle Instance, const AnsiString ResName, const char * ResType);

Call Create to instantiate a TResourceStream, passing in parameters that identify the resource in a specified instance. TResourceStream 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. 

In the first constructor syntax, the ResName is the string associated with the resource in the .rc file that was compiled with the application. If the resource is associated with an integer ID rather than a string, use the string representation of the integer after a pound sign. Thus, for example, a resource with an integer identifier of 128 be identified by a ResName of #128.

Note: Specifying resources by ID requires less memory than specifying resources by name.
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  

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!