Get resource name

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.0


Get resource name (resType; resID{; resFile}) String

ParameterTypeDescription
resTypeString4-character resource type
resIDNumberResource ID number
resFileDocRefResource file reference number, or
all open resource files, if omitted
Function resultStringName of the resource

Description

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 and sets the OK variable to 0 (zero).

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)

See Also

SET RESOURCE PROPERTIES.

System Variables or Sets

The OK variable is set to 0 if the resource does not exist; otherwise, it is set to 1.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next