PA_GetHandleSize

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

version 2003


PA_GetHandleSize (handle) long

ParameterTypeDescription
handlePA_HandleHandle to a block of memory
Function resultlongSize of the data led to by handle

Description

The routine PA_GetHandleSize returns the size of the data led to by handle in bytes.

Handle should be a PA_Handle allocated by PA_NewHandle.

Example

Create a new handle that duplicates an existing handle.

   PA_Handle DuplicateHandle( PA_Handle hsrc )
   {
      long      size;
      PA_Handle   hdest;
      char      *pSrc, *pDest;
      
   // get the source handle size
      size = PA_GetHandleSize( hsrc );

   // make duplicate handle and copy data to it
      hdst = PA_NewHandle( size );
      if ( hdest )
      {
         pSrc = PA_LockHandle( hsrc );
         pDest = PA_LockHandle( hdest );
         PA_MoveBlock( pSrc, pDest, size );
         PA_UnlockHandle( srce );
         PA_Unlockhandle( hdest );
      }
      return hdest;
   }

See Also

PA_NewHandle, PA_SetHandleSize.

Error Handling

Use PA_GetLastError to see if an error occurred (not a valid handle, etc.).


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