PBGetMenuString
PowerScript function
Description
Gets the name of the item at a given position in a menu.
Syntax
|
1 |
PBGetMenuString ( hmenu, nPos, caption, nMaxLength) |
|
Argument |
Description |
|---|---|
|
hmenu |
A long for the menu handle |
|
nPos |
An integer for the position of the menu item, |
|
caption |
A string passed by reference that captures the name |
|
nMaxLength |
An integer that sets the maximum length of the value |
Return value
Long. Returns 1if it succeeds and -1 if an error occurs. If any
argument is null, PBGetMenuString returns null.
Usage
Use PBGetMenuString to get the name of a menu item. This function is
useful for some automated testing programs that cannot get menu item names
from the Text property for menus that use the contemporary style.
Examples
This statement gets the first menu item of the submenu of the w_main
window using the GetMenu and GetSubMenu WIN32 API functions from the
user.dll library:
|
1 2 3 4 5 6 7 8 9 |
string ls_menu long hmenu long submenu int ll_ret hmenu = GetMenu(handle(w_main)) submenu = GetSubMenu(hmenu,0) ll_ret = PBGetMenuString(submenu,0,ls_menu,5) messagebox ("Menu Test", "return value = & "+string(ll_ret)+ " menu caption is "+ls_menu) |
This example assumes you have made the following Local External
Functions declarations:
|
1 2 3 |
function long GetMenu ( long hwnd) library "user32.dll" function long GetSubMenu ( long hparent,int pos) & library "user32.dll" |