PA_CreateResourceFromHandle

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


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

ParameterTypeDescription
resFileshortFile reference number of the file to access
kindunsigned longKind (4 Bytes type) of the resource to create
idshortUnique resource ID (or -1)
namechar*Resource name
resourceHandlePA_HandleResource data handle
Function resultshortUnique 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


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next