4D v12.4

Get resource name

Home

 
4D v12.4
Get resource name

 

Get resource name 


 

Get resource name ( resType ; resID {; resFile} ) -> Function result 
Parameter Type   Description
resType  String in 4-character resource type
resID  Longint in Resource ID number
resFile  DocRef in Resource file reference number, or all open resource files, if omitted
Function result  String in Name of the resource

The Get resource name command returns the name of the resource whose type is passed in resType and whose ID number is passed in resID.

If you pass a valid resource file reference number in the parameter resFile, the resource is searched for within that file only. If you do not pass the parameter resFile, the resource is searched for within the current open resource files.

If the resource does not exist, Get resource name returns an empty string.

Example  

The following project method copies a resource, and its resource name and attributes, from one resource file to another:

  ` COPY RESOURCE Project Method
  ` COPY RESOURCE ( String ; Long ; Time ; Time )
  ` COPY RESOURCE ( resType ; resID ; srcResFile ; dstResFile )
 
 C_STRING(4;$1)
 C_LONGINT($2)
 C_TIME($3;$4)
 C_BLOB($vxResData)
 
 GET RESOURCE($1;$2;$vxData;$3)
 If(OK=1)
    SET RESOURCE($1;$2;$vxData;$4)
    If(OK=1)
       SET RESOURCE NAME($1;$2;Get resource name($1;$2;$3);$4)
       SET RESOURCE PROPERTIES($1;$2;Get resource properties($1;$2;$3);$4)
    End if
 End if

Once this project method is present in your application, you can write:

  ` Copy the resource 'DATA' ID = 15000 from file A to file B
 COPY RESOURCE("DATA";15000;$vhResFileA;$vhResFileB)

 
PROPERTIES 

Product: 4D
Theme: Resources
Number: 513

 
HISTORY 

Created: 4D v6

 
SEE ALSO 

SET RESOURCE PROPERTIES