This chapter provides reference material for the resource loading API defined in the header file UIResources.h
.
Resource Loading Functions and Macros
ResLoadConstant Function
Purpose
Loads a constant from a 'tint'
resource and returns its value.
Declared In
UIResources.h
Prototype
uint32_t ResLoadConstant ( DmOpenRefdatabase
, DmResourceIDrscID
)
Parameters
-
→ database
- Open database containing the resource.
-
→ rscID
- The ID of the
'tint'
resource (symbolically namedconstantRscType
) to load.
Returns
The four-byte value of the constant in the resource, or 0 if the resource could not be found. The return value may be cast as necessary.
Comments
Use this function to load "soft constants"—constant values that are stored as 'tint'
resources. (All open resource databases are searched for the resource ID you specify.) You should store a constant value as a resource when its value changes depending on the locale.
As an example, consider the maximum length of the Alarm Sound trigger label in the Datebook application's preferences panel. The list displayed by this trigger uses the localized name for each sound stored in the system. Because localized names are used, the maximum length that the Datebook application allows for the label differs depending on the current locale. The maximum length is stored as a resource constant so that each overlay database can specify a different value for the constant.
See Also
ResLoadConstantV50 Function
Purpose
Loads a constant from a 'tint'
resource and return its value.
Declared In
UIResources.h
Prototype
uint32_t ResLoadConstantV50 (
DmResourceID rscID
)
Parameters
Returns
The four-byte value of the constant in the resource, or 0 if the resource could not be found. The return value may be cast as necessary.
Compatibility
This function is provided for backward compatibility only. Use ResLoadConstant()
instead.
ResLoadForm Function
Purpose
Copies and initializes a form resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the form.
Declared In
UIResources.h
Prototype
FormType *ResLoadForm ( DmOpenRefdatabase
, DmResourceIDrscID
)
Parameters
Returns
A pointer to a FormType
structure representing the form.
ResLoadFormV50 Function
Purpose
Copies and initializes a form resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the form.
Declared In
UIResources.h
Prototype
void *ResLoadFormV50 (
DmResourceID rscID
)
Parameters
Returns
The handle of the memory block that the form is in.
Compatibility
This function is provided for backward compatibility only. Use ResLoadForm()
instead.
ResLoadFormWithFlags Function
Purpose
Copies and initializes a form resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the form.
Declared In
UIResources.h
Prototype
FormType *ResLoadFormWithFlags ( DmOpenRefdatabase
, DmResourceIDrscID
, WinFlagsTypewindowFlags
)
Parameters
-
→ database
- Open database containing the resource.
-
→ rscID
- The resource ID of the form.
-
→ windowFlags
- Window attributes to use when creating the dialog. See
WinFlagsType
. The attributewinFlagModal
is set for you.
Returns
A pointer to a FormType
structure representing the form.
ResLoadMenu Function
Purpose
Copies and initializes a menu resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the menu.
Declared In
UIResources.h
Prototype
MenuBarType *ResLoadMenu ( DmOpenRefdatabase
, DmResourceIDrscID
)
Parameters
Returns
A pointer to a MenuBarType
structure containing the menus.
ResLoadMenuV50 Function
Purpose
Copies and initializes a menu resource. The structures are complete except pointer updating. Pointers are stored as offsets from the beginning of the menu.
Declared In
UIResources.h
Prototype
void *ResLoadMenuV50 (
DmResourceID rscID
)
Parameters
Returns
The handle of the memory block that the menu is in.
Compatibility
This function is provided for backward compatibility only. Use ResLoadMenu()
instead.
ResLoadString Function
Purpose
Loads a constant from a string resource and returns its value.
Declared In
UIResources.h
Prototype
char *ResLoadString ( DmOpenRefdatabase
, DmResourceIDrscID
, char*strP
, size_tmaxLen
)
Parameters
-
→ database
- Open database containing the resource.
-
→ rscID
- The resource ID of the string.
-
← strP
- Upon return, the string parameter you pass in contains the contents of the string resource.
-
→ maxLen
- The size in bytes of the
strP
parameter.