version 2003
PA_DetachResource (resFile; resourceHandle)
| Parameter | Type | Description | |
| resFile | short | File reference number of the file to access | |
| resourceHandle | PA_Handle | Resource handle to detach |
Description
The routine PA_DetachResource tells the Internal Resource Manager that the resource data referenced by resHandle (from file resFile) is no longer a resource; thus, the plug-in can use it like a regular PA_Handle (PA_DisposeHandle, PA_SetHandleSize).
If the resource does not exist or if resFile is an invalid file reference number, the routine leaves the data pointed to by resData unchanged, returns 0L, and PA_GetLastError returns -5 ("Resource not found").
Example
Load a resource handle, and use it as a regular handle.
PA_Handle h;
h = PA_GetResourceHandle(resFile, 'TiTi', 128);
if(h)
{
PA_DetachResource(resFile, h);
if(PA_GetLastError() ==eER_NoErr)
{
/* OK, h points now to a "regular" data, we can use it as we want */
. . .
. . .
PA_DisposeHandle(h);
}
}
See Also
Error Handling
Use PA_GetLastError to see if an error occurred