PA_GetResourceKindList

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

version 2003


PA_GetResourceKindList (resFile; kindList) long

ParameterTypeDescription
resFileshortFile reference number of the file to access
kindListunsigned long*Array of kinds
Function resultlongNumber of kinds

Description

The routine PA_GetResourceKindList fills the buffer pointed to by kindList with all of the kinds present in the file referenced by resFile, and then returns the number of kinds.

IMPORTANT NOTE

PA_GetResourceKindList returns the number of kinds, not the size of the buffer kindList.

kindList is an unsigned long array, starting at element 0 and ending at element (returned value - 1).

If resFile is invalid then it contains no kinds; PA_GetResourceKindList returns 0.

First call the routine passing 0L in kindList to get the count of kinds. Then, allocate a buffer of (thisCount * sizeof(unsigned long)) and call the routine again.

Example

Loading the kind list:

   unsigned long   *kinds, currentKind;
   long         count, i;

   // First, call the routine with a null kindList to get the number of kinds
   count = PA_GetResourceKindList(resFile, 0L);
   if(count)
   {
   // Then, allocate a buffer and call the routine again
      kinds = malloc(count * sizeof(unsigned long));
      count = PA_GetResourceKindList(resFile, kinds);
   // Do something with the kinds
      for(i = 0; i < count; i++)
      {
         currentKind = kinds[i];
      /* . . . do something with this kind . . . */
      }
   }

See Also

PA_GetIndexedResourceKind, PA_GetResourceIDList, PA_GetResourceNameList.

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