PA_CreateResourceFromHandle


version 2003


PA_CreateResourceFromHandle (resFile; kind; id; name; resourceHandle) → short

Parameter Type Description
resFile short File reference number of the file to access
kind unsigned long Kind (4 Bytes type) of the resource to create
id short Unique resource ID (or -1)
name char* Resource name
resourceHandle PA_Handle Resource data handle
Function result short Unique ID for this resource

Description

The routine PA_CreateResourceFromHandle adds a resource of type kind and unique number ID to the resource file resFile . The resource will be filled with the data pointed to by resourceHandle .

If resFile is an invalid file reference number, the routine does nothing.

IMPORTANT NOTE

After the call, the handle belongs to the resource file. Do not dispose of it

.

Example

Create a picture from a picture variable.

   // Call it mPIC for "my picture". PICT is already used by 4D
   #define kPictResourceType   'mPIC'
   short PA_AddPictureInternalResource(short resFile, PA_Variable v, char *name)
   {
      short   ID = -1;
      PA_Handle h;
      h = PA_GetPictureHandleVariable(v, 0L); // ignore PA_PictureInfo
      if(h)
         ID = PA_CreateResourceFromhandle(resFile, kPictResourceType, -1, name, h);
      return ID; // Call PA_GetLastError() in the calling routine
   }
   

See Also

PA_CreateResource .

Error Handling

Use PA_GetLastError to see if an error occurred