IOleControl::OnMnemonic method

Informs a control that the user has pressed a keystroke that represents a keyboard mneumonic.


HRESULT OnMnemonic(
  MSG *pMsg



A pointer to the MSG structure describing the keystroke to be processed.

Return Value

This method can return the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following values.

Return code Description
The method completed successfully.
The control does not handle mnemonics. This indicates an unexpected condition and a caller error. For example, the caller has mismatched which control has which mnemonic.


The keystroke must match one of the ACCEL entries in the mnemonic table returned through IOleControl::GetControlInfo. The control takes whatever action is appropriate for the keystroke.

Notes to Callers

A container of a control is allowed to cache the control's CONTROLINFO structure, provided that the container implements IOleControlSite::OnControlInfoChanged to know when it must update its cached information.

Notes to Implementers

If a control changes the contents of its CONTROLINFO structure, it must notify its container by calling IOleControlSite::OnControlInfoChanged.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ocidl.h

See Also