Jump to content

WinSetMenuItemText

From EDM2
Revision as of 18:33, 9 April 2025 by Martini (talk | contribs) (Created page with "This macro sets the text for Menu indexed item to buffer. ==Syntax== WinSetMenuItemText(hwndMenu, usId, pText) ==Parameters== ;hwndMenu (HWND) - Input : Menu window handle. ;usId (USHORT) - Input : Identity of the menu item. ;pText (PSZ) - Input : Text for the menu item. ==Returns== ;rc (BOOL) - returns : TRUE Successful completion : FALSE Error occurred. ==Parameters== ;hwndMenu (HWND) - Input : Menu window handle. ;usId (USHORT) - Input : I...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This macro sets the text for Menu indexed item to buffer.

Syntax

WinSetMenuItemText(hwndMenu, usId, pText)

Parameters

hwndMenu (HWND) - Input
Menu window handle.
usId (USHORT) - Input
Identity of the menu item.
pText (PSZ) - Input
Text for the menu item.

Returns

rc (BOOL) - returns
TRUE Successful completion
FALSE Error occurred.

Parameters

hwndMenu (HWND) - Input
Menu window handle.
usId (USHORT) - Input
Identity of the menu item.
pText (PSZ) - Input
Text for the menu item.
rc (BOOL) - returns
TRUE Successful completion
FALSE Error occurred.

Remarks

This macro expands to:

#define WinSetMenuItemText (hwndMenu, usId, pszText)
  ((BOOL)WinSendMsg(hwndMenu,
                    MM_SETITEMTEXT,
                    MPFROMSHORT(id),
                    MPFROMP(pszText)))

This function requires the existence of a message queue.

Related Functions

Related Messages

Example Code

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND      hwndMenu;  /*  Menu window handle. */
USHORT    usId;      /*  Identity of the menu item. */
PSZ       pText;     /*  Text for the menu item. */
BOOL      rc;        /*  Success indicator. */

rc = WinSetMenuItemText(hwndMenu, usId, pText);

This example sets the options text in a menu.

#define INCL_WINWINDOWMGR
#include <OS2.H>
#define IDM_OPTIONS 900

HWND   hwndMenu;

WinSetMenuItemText(hwndMenu,
                    IDM_OPTIONS,
                    "Options");