Επεξεργασία

Κοινή χρήση μέσω


IContextMenu2::HandleMenuMsg method (shobjidl_core.h)

Enables client objects of the IContextMenu interface to handle messages associated with owner-drawn menu items.

Syntax

HRESULT HandleMenuMsg(
  UINT   uMsg,
  WPARAM wParam,
  LPARAM lParam
);

Parameters

uMsg

Type: UINT

The message to be processed. In the case of some messages, such as WM_INITMENUPOPUP, WM_DRAWITEM, WM_MENUCHAR, or WM_MEASUREITEM, the client object being called may provide owner-drawn menu items.

wParam

Type: WPARAM

Additional message information. The value of this parameter depends on the value of the uMsg parameter.

lParam

Type: LPARAM

Additional message information. The value of this parameter depends on the value of the uMsg parameter.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

IContextMenu2::HandleMenuMsg is generally replaced by HandleMenuMsg2. HandleMenuMsg2 is called when IContextMenu determines that IContextMenu3 is supported and receives one of the messages specified in the description of the uMsg parameter. However, in some cases, IContextMenu2::HandleMenuMsg is still called.

If IContextMenu2 or IContextMenu3 is needed, the best implementation for new context menus is to implement all their logic in HandleMenuMsg2 and have their IContextMenu2::HandleMenuMsg implementation simply delegate the call to HandleMenuMsg2 and pass NULL as the plResult parameter.

Note  If IContextMenu3 is not implemented, there is no guarantee that IContextMenu2 will be called in its place. In some cases, the absence of IContextMenu3 is determined and then the process is halted.
 

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)
DLL Shell32.dll (version 4.0 or later)

See also

HandleMenuMsg2

IContextMenu2