4D v13.4

GET RESOURCE

Home

 
4D v13.4
GET RESOURCE

GET RESOURCE 


 

GET RESOURCE ( resType ; resID ; resData {; resFile} )  
Parameter Type   Description
resType  String in 4-character resource type
resID  Longint in Resource ID number
resData  BLOB in BLOB field or variable to receive the data
in Contents of the resource
resFile  DocRef in Resource file reference number, or all open resource files, if omitted

The GET RESOURCE command returns in the BLOB field or variable resData the contents of the resource whose type and ID is passed in resType and resID.

Important: You must pass a 4-character string in resType.

If the resource is not found, the resData parameter is left unchanged and the OK variable is set to 0 (zero).

If you pass a valid resource file reference number in resFile, the resource is searched for in that file only. If you do not pass resFile, the first occurrence of the resource found in the resource files chain is returned.

Note: A resource can be at least several megabytes in size.

Remember that you are working with Mac OS-based resources. No matter what the platform, internal resource data such as Long Integer is stored using Macintosh byte ordering. On Windows, the data for standard resources (such as string list and pictures resources) is automatically byte swapped when necessary. On the other hand, if you create and use your own internal data structures, it is up to you to byte swap the data you extract from the BLOB (i.e., passing Macintosh byte ordering to a command such as BLOB to longint).

Example  

See the example for the command SET RESOURCE.

If the resource is found, OK is set to 1. Otherwise, it is set to 0 (zero).

If there is not enough memory to load the resource, an error is generated. You can catch this error with an error-handling method installed using ON ERR CALL.

 
PROPERTIES 

Product: 4D
Theme: Resources
Number: 508

The OK variable is changed by the commandThis command modifies the Error system variable

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v6

 
SEE ALSO 

BLOB Commands
Resources
SET RESOURCE