HMExtractHelpMsg
HMExtractHelpMsg Extract the help balloon content
#include <Balloons.h> Help Manager
OSErr HMExtractHelpMsg ( whichType, whichResID, whichMsg,
whichState, aHelpMsg );
ResType whichType ; specifies the format of the help message
short whichResID ; the resource ID of the help resource whose content
you wish to extract.
short whichMsg ; Specifies the index of the component you wish to
extract.
short whichState ; specifies the state of the item whose message you
wish to extract.
HMMessageRecord * aHelpMsg; a help message record.
You can use HMExtractHelpMsg to extract the help balloon content
specified in existing help resources.
whichType specifies the format of the help message. Supply one of these
constants.kHMMenuResType, kHMDialogResType,
kHMRectListResType, kHMOverrideResType,
kHMFinderApplResType
Note: If HMCompareItem appears as a component of an
'hmnu' resource that you're examining, neither this
function nor HMGetIndHelpMsg performs a
comparison against the current name of any menu item.
Instead, these functions return the messages listed in
your HMCompareItem components in the order in which
they appear in the 'hmnu' resource.
whichMsg specifies the index of the component you wish to extract. (Do not
count the header information as a component to index.) After the
header information, for example, the first component in a menu help
resource defines help for missing items; the second item defines help
for the menu title.
whichResI the resource ID of the help resource whose content you wish to
extract. Specify the index of the component you wish to extract in the
whichMsg parameter. (Do not count the header information as a
component to index.) After the header information, for example, the
first component in a menu help resource defines help for missing
items; the second item defines help for the menu title.
whichState specifies the state of the item whose message you wish to extract.
Use one of the following constants for the whichState parameter. For
the kHMRectListResType, kHMOverrideResType, and
kHMFinderApplResType resource types-which do not have
states-supply the kHMEnabledItem constant for the whichState
parameter.
aHelpMsg a help message record . The aHelpMsg parameter is of data type
HMMessageRecord. Help Balloons in Dynamic Windows
describes the fields of this record.
Returns: an Error Code.
noErr (0) No error
paramErr (-50) Error in parameter list
memFullErr (-108) Not enough room in heap zone
resNotFound (-192) Unable to read resource
hmSkipBalloon (-857) No balloon content to fill in
hmWrongVersion (-858) Wrong version of Help Manager resource
hmUnknownHelpType (-859) Help message record contained a bad type

Notes: In the following example, a menu help resource has a resource ID of 128. A
2 is supplied as the whichMsg parameter to retrieve information about the
resource's second component (the second component after the header, that
is), which is the menu title. The menu title has four possible states; to
retrieve the help message for the menu title in its dimmed state, the
constant kHMDisabledItem is used for the whichState parameter. The help
message record returned in aHelpMsg is then passed to
HMShowMenuBalloon, which displays the message in a balloon with its
tip located at the point specified in the tip parameter.
#include <Balloons.h>
void MyExtractHelpMsg ( )
{
Point tip;
Rect alternateRect;
rc = HMExtractHelpMsg(kHMMenuResType, 128, 2,
kHMDisabledItem, & aHelpMsg);
if (rc == noErr)
// be sure to assign a tip and rectangle coordinates here
rc = HMShowBalloon(& aHelpMsg, tip, & alternateRect, nil,
0,0, kHMRegularWindow);
}
To retrieve all of the help balloon messages for a given resource, set
whichMsg to 1 and make repeated calls to HMExtractHelpMsg,
incrementing whichMsg by 1 on each subsequent call until it returns the
hmSkippedBalloon result code.