This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The IMessageFormEx2interface extends the IMessageFormExinterface with an alternate mechanism for querying Message Forms for supported menu items—using an approach that supports hundreds of menu items.

Methods in Vtable Order

IMessageFormEx2 methods Description


Queries a Messaging Add-in to determine if it supports a particular command bar menu. This method provides an alternate mechanism compared to the one used by IMessageFormEx::GetMenuCapabilities.


Since the mechanism used by IMessageFormExlimits the number of possible menu items to 32, IMessageFormEx2was created to expand that limit by more than ten times.

Like IMessageFormEx::GetMenuCapabilities, IMessageFormEx2::GetMenuCapabilityis called by the Messaging Application to query a Messaging add-in to determine which menu commands it can process (that is, which form menu commands to enable and which to disable).

The difference in the two method names: one is plural ( GetMenuCapabilities), and the other is singular ( GetMenuCapability).

A Messaging add-in must implement the IMessageFormEx2interface in order to add menu capabilities beyond the Standard set of MESSAGEFORMHOST2_CMDBARCAPflags. For information on the Extended set of command bar capability constants, see Message Form Host Command Bar Capability Flags.

New Behavior for GetMenuCapabilities

When querying Message forms based on IMessageFormEx2with IMessageFormEx::GetMenuCapabilities, the behavior of the dwFlagsparameter differs from that used for Message forms created using IMessageFormEx. The changes are as follows:

  • The top four bits of dwFlagsbecome "Region" bits, and the remaining 28 bits are treated as the "Menu Capability" bits.

  • This approach provides 16 x 28 = 448 different Menu Capabilities ( IMessageFormExsupports a maximum of 32).

  • The extended set of command bar capabilities introduced in Windows Mobile 6.5 are associated with Region 1. For a listing of the extended capabilities, see The Extended Set of Command Bar Capability Constantssection in Message Form Host Command Bar Capability Flags.

  • The capabilities in Region 1 are named as MESSAGEFORMHOST2_CMDBARCAP2_xxx, and in Region 2 as MESSAGEFORMHOST2_CMDBARCAP3_xxx, etc.

For backward compatibility, the way to determine whether a Message Form supports the extended menu capabilities is as follows:

  • When dwFlagshas any region bits set, but does not have any menu item bits set— IMessageFormEx::GetMenuCapabilitiesruns in an alternate mode known as Detection Mode.

  • In Detection Mode, GetMenuCapabilitiesreturns (in the * pdwEnableout parameter) a bitmask with all of the Menu Capability bits set to one if extended capability is supported, all bits set to zero if not.

For example, the call GetMenuCapabilites(0x10000000, &dwEnable)returns 0x1fffffffif the Message Form supports the extended menu capabilities, and 0x10000000if it does not.

The new behavior of the Messaging Application (Form Host) is demonstrated in the following code example.

Copy Code
#define MENU_CAPABILITY_MASK 0xfffffff
IForm->GetMenuCapabilites(dwFlags, &dwEnable);  // For
Region 0 (pre-Windows Mobile 6) menu items.

if (SUCCEEDED(IForm->GetMenuCapabilites(0x10000000,
&dwEnable)) && (dwEnable & MENU_CAPABILITY_MASK ==
   // Loop through the extend menu capabilites.
   for (i = 1; i < 16; i++)
	IForm->GetMenuCapabilites(dwFlags | (i << 28),


Header cemapi.h
Library cemapi.lib
Windows Mobile Windows Mobile 6 and later

See Also