ITfMenu::AddMenuItem method (ctfutb.h)

Adds an item to the menu that the language bar will display for the button.

Syntax

HRESULT AddMenuItem(
  [in] UINT        uId,
  [in] DWORD       dwFlags,
  [in] HBITMAP     hbmp,
  [in] HBITMAP     hbmpMask,
  [in] const WCHAR *pch,
  [in] ULONG       cch,
       ITfMenu     **ppMenu
);

Parameters

[in] uId

Contains the menu item identifier.

[in] dwFlags

Contains zero or a combination of one or more of the TF_LBMENUF_* values that specify the type and state of the menu item.

[in] hbmp

Contains the handle of the bitmap drawn for the menu item. If this is NULL, no bitmap is displayed for the menu item.

[in] hbmpMask

Contains the handle of the mask bitmap. This is a monochrome bitmap that functions as a mask for hbmp. Each black pixel in this bitmap will cause the corresponding pixel in hbmp to be displayed in its normal color. Each white pixel in this bitmap will cause the corresponding pixel in hbmp to be displayed in the inverse of its normal color.

To have the bitmap displayed without any color conversion, create a monochrome bitmap the same size as hbmp and set each pixel to black (RGB(0, 0, 0)).

If hbmp is NULL, this parameter is ignored.

[in] pch

Pointer to a WCHAR buffer that contains the text to be displayed for the menu item. The length of the text is specified by cch.

[in] cch

Specifies the length, in WCHAR, of the menu item text in pch.

ppMenu

[in, out] Pointer to an ITfMenu interface pointer that receives the submenu object. This parameter is not used and must be NULL if dwFlags does not contain TF_LBMENUF_SUBMENU.

If the submenu item is successfully created, this parameter receives an ITfMenu object that the caller uses to add items to the submenu.

If dwFlags contains TF_LBMENUF_SUBMENU, this value must be initialized to NULL prior to calling this method because, in most cases, this is a marshalled call. Not initializing this variable results in the marshaller attempting to access random memory.

Return value

This method can return one of these values.

Value Description
S_OK
The method was successful.
E_FAIL
An unspecified error occurred.
E_OUTOFMEMORY
A memory allocation failure occurred.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ctfutb.h
DLL Msctf.dll
Redistributable TSF 1.0 on Windows 2000 Professional

See also

ITfMenu

TF_LBMENUF_* Constants