|
![]() |
![]() |
version 2003
PA_GetResource (resfile; kind; resID; resData) → long
Parameter | Type | Description | |
resfile | short | → | File reference number of the file to access |
kind | unsigned long | → | Kind (4 Bytes type) of resource to load |
resID | short | → | Unique resource ID |
resData | char* | ← | Data of the resource |
Function result | long | ← | Size of the received data in bytes |
Description
The routine
PA_GetResource
loads the internal resource of type
kind
and ID
resID
(in the file referenced by
resFile
), and fills the buffer pointed to by
resData
with its content. It then returns the size of the data in bytes.
Pass the file reference number of the file that holds the resource in
resFile
.
Pass the 4-Bytes type code of the resource (such as 'PICT', 'TEXT', or anything you need) in
kind
.
In
resData
, pass a pointer to the block of memory that will be filled with the resource content.
The data pointed to by
resData
must be large enough to receive the resource content. The plug-in can get this size by calling the routine passing 0L in the
resData
parameter, or, more simply, it can call the
PA_GetResourceSize
routine.
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").
NOTE
resData
contains a copy of the resource; you can use it or dispose of it as you like. To get a handle to the resource, use
PA_GetResourceHandle
. You can use less memory if you only want to read the resource.