PA_WriteResourceHandle


version 2003


PA_WriteResourceHandle (resFile; resHandle)

Parameter Type Description
resFile short Resource file reference
resHandle PA_Handle Handle of the resource

Description

The routine PA_WriteResourceHandle saves the content of the resource referenced by the handle resHandle to disk thus updating the resource file resFile .

Example

Load a resource, modify it and then save it.

   typedef struct {
      short   f1;
      short   f2;
      . . .
      long   fN;
   } TOTO, *TOTOptr, **TOTOhdle;
 
   PA_Handle      h;
   TOTOptr      pt;
 
   // First, lock the resource over the network
   if(PA_LockResource(resFile, 'toto', 128))
   {
   // The, load the handle
      h = PA_GetResourceHandle(resFile, 'toto', 128);
      if(h)
      {
   // Lockit if following lines can move memory
         pt = (TOTOptr) PA_LockHandle(h);
   // Modify it
         pt->f1 = . . .;
         pt->f2 = . . .;
         SuperRoutine(&pt->fN);
   // Unlock it, so that 4D can purged it from memory
         PA_UnlockHandle(h);
   // Write the resource
         PA_WriteResourceHandle(resFile, h);
      }
   // Other folks can change it now.
      PA_UnlockResource(resFile, 'toto', 128);
   }

See Also

PA_GetResourceHandle , PA_SetResource .

Error Handling

None.