Help Center

ToggleItemfunction

Toggles the checked state of a menu item.

Windowsfunctiondoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

FUNCTION ToggleItem (BYVAL hMenu AS HMENU, BYVAL uItem AS DWORD, BYVAL fByPosition AS LONG = FALSE) AS LONG

Parameters

NameDescription
hMenuA handle to the menu that contains the menu item.
uItemThe menu item whose check-mark attribute is to be set or unset.
fByPositionThe meaning of item. If this parameter is FALSE, item is a menu item identifier. Otherwise, it is a menu item position, where position = 1 for the first position, position = 2 for the second, and so on.

Return value

The return value specifies the previous state of the menu item (either MF_CHECKED or MF_UNCHECKED). If the menu item does not exist, the return value is –1.

Description

Toggles the checked state of a menu item.

Example

CMenu.ToggleItem(hMenu, IDM_OPEN)

Reference

  • Documented in Windows/WIndows Controls/CMenu Class.md
  • Topic: About Menus