GetMenuHandle
To get a handle to a menu in your application, use the GetMenuHandle function.
FUNCTION GetMenuHandle(ID as Integer) as MenuHandle
ID The id of the desired menu. Note: You cant trust
that menus always have the same id in REALbasic, like
the Edit menu does not always have the id 2. So use the
example bellow to locate the desired menu handle.
Description:
Gets a integer handle to one of your application menu, in the Menubar.
Example:
For n = 1 to 10
AppMenu=GetMenuHandle(n)
if AppMenu <> nil then
if GetMenuItemText(AppMenu,1)="Undo" then
exit
end if
end if
next
// Here above the Handle to the Edit menu
// was located by searcing for the Undo menu item.
// After this procedure the AppMenu variable
// should contain a handle to the Edit menu.
Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS 68k
Unsupported platforms:
* Windows x86