Developer

API Reference

IResFile_GetNamedId()

Brew Release
Brew MP 1.0.2
See Also
IResFile IResFile_Get()
Description

Gets the id for a named resource from a resource file. Names for a resource can be given as a variable set of, null terminated, string arguments. Each string specifies one or more levels in the naming tree. A simple string without '.' characters specifies a single level in the naming tree where as a dot separated set of names in a string specify a series of names in the naming tree.
Note: The ID returned contains both the 16 bit search path index and the 16 bit resource file ID. The high order bits contain the search path index, and the low order bits contain the resource ID. So for example, if the resource ID found was 255, and the search path index was 1 (2nd file in the search path), the ID returned would be: 0x000100FF
This ID is compatible with all IResFile functions which accept a 32bit ID parameter.
Finding the id for a named image in the resource files could look like:
      IResFile_GetNamedId(piResFile, RESTYPE_IMAGE, &resid, "Main", "Background", "Image", 0)

or could look like:
      IResFile_GetNamedId(piResFile, RESTYPE_IMAGE, &resid, "Main.Background.Image", 0)

or a mix of the above:
      IResFile_GetNamedId(piResFile, RESTYPE_IMAGE, &resid, "Main.Background", "Image", 0)
Parameters
  • pif
    []:
    [in] A pointer to an IResFile object.
  • restype
    []:
    [in] Type of the resource to be loaded
  • presid
    []:
    [out] A pointer to a storage area for the resulting resource id ...: [in] Null-terminated string list of names (see above)

Interface
Prototype
   int IResFile_GetNamedId(IResFile *pif, uint16 restype, uint32 *presid, ...);
Return
   AEE_SUCCESS:   The named resource was found and the resource id located
   AEE_EBADPARM:  One of the given parameters is invalid
   EBADSTATE:     Resource file is not open 
   EUNSUPPORTED:  Resource file does not support named resources
   EUNABLETOLOAD: Named resource could not be resolved 
Side Effect
None
Comment
This function is a shortcut function for the actual interface function IResFile_GetNamedIdV which takes an actual vararg parameter.
  • Follow