LoadLocalizedMenuBar
- Updated2023-02-21
- 3 minute(s) read
int LoadLocalizedMenuBar (int destinationPanelHandle, const char *menuBarResourceFile, int menuBarResourceID, const char *languageResourceFile, int *menuBarHandle);
Purpose
This function is similar to LoadMenuBar, except that it applies the translated strings in the language resource file (*.lwl) to the specified menu bar.
Refer to LoadMenuBar help for more information.
Use the Windows SDK function GetLocaleInfo to get the system or user default language.
Parameters
| Input | ||
| Name | Type | Description |
| destinationPanelHandle | int | The handle for the panel on which the menu bar resides. You can obtain this handle from functions such as LoadPanel and NewPanel. If the destination panel is not currently in memory, pass a zero as the destinationPanelHandle and later assign this menu bar to a panel using SetPanelMenuBar. |
| menuBarResourceFile | const char * | The name of the User Interface Resource file (*.uir) or the Text Format User Interface file (*.tui) that contains the menu bar. You can use a complete pathname or a simple filename. If the name is a simple filename (i.e., contains no directory path) and the file is listed in the project, then the file is loaded using the pathname from the project. If the name is a simple filename (i.e., contains no directory path) but the file is not listed in the project, then the file is loaded from the directory containing the project. |
| menuBarResourceID | int | If the specified file is a User Interface Resource (*.uir) file, the menuBarResourceID is the defined constant that was assigned to the menu bar in the User Interface Editor. The menu bar resource ID can be found in the UIR header file. If the file is a Text Format User Interface (*.tui) file, the menuBarResourceID is the header number of the .tui file section in which the menu bar is defined. For example, if the section header for the desired menu bar is [MenuBar003], then the menuBarResourceID would be 3. This function loads all of the menus and menu items in the .tui file whose section headers are of the form [MenuBarNNN_...] where NNN is the menuBarResourceID passed to the function. The menuID or menuItemID that you pass to User Interface Library functions is based on a depth-first traversal of all of the items in the menu tree, starting at 2. For submenu items, the submenu itself has an ID that is one greater than the item id of the submenu entry in the parent menu. If you save a .tui file in the User Interface Editor in LabWindows/CVI 5.0 or later, and you have an up-to-date include (.h) file generated by the User Interface Editor, you can use the panel, control, menu bar, menu, and menu item constants in the include file as parameters to User Interface Library functions. Use the menuBarResourceID only once to load the menu bar into memory. In subsequent function calls, refer to this menu bar with the menuBarHandle returned by this function. |
| languageResourceFile | const char * | This file contains translated strings of the strings in the menu bar resource file. |
| Output | ||
| Name | Type | Description |
| menuBarHandle | int | The value that you must use in subsequent function calls to specify this menu bar. Zero is not a valid menu bar handle. Use DiscardMenuBar to discard. |
Return Value
| Name | Type | Description | ||||||||||||||||||
| status | int | Indicates whether the function was successful. A zero indicates success. A negative value indicates an error. If the value is from –1 to –999, it is one of the error values defined in userint.h. Otherwise, it is one of the error values defined in toolbox.h. Use GetGeneralErrorString in the toolbox to get a description. Among the more commonly encountered errors are:
|
Additional Information
Library: UI Localization Tools
Include file: localui\localui.h
LabWindows/CVI compatibility: LabWindows/CVI 5.5 and later