OleTranslateAccelerator function (ole2.h)

Called by the object application, allows an object's container to translate accelerators according to the container's accelerator table.

Syntax

HRESULT OleTranslateAccelerator(
  [in] LPOLEINPLACEFRAME     lpFrame,
  [in] LPOLEINPLACEFRAMEINFO lpFrameInfo,
  [in] LPMSG                 lpmsg
);

Parameters

[in] lpFrame

Pointer to the IOleInPlaceFrame interface to which the keystroke might be sent.

[in] lpFrameInfo

Pointer to an OLEINPLACEFRAMEINFO structure containing the accelerator table obtained from the container.

[in] lpmsg

Pointer to an MSG structure containing the keystroke.

Return value

This function returns S_OK on success. Other possible values include the following.

Return code Description
E_FAIL
The object should continue processing this message.

Remarks

Object servers call OleTranslateAccelerator to allow the object's container to translate accelerator keystrokes according to the container's accelerator table, pointed to by lpFrameInfo. While a contained object is the active object, the object's server always has first chance at translating any messages received. If this is not desired, the server calls OleTranslateAccelerator to give the object's container a chance. If the keyboard input matches an accelerator found in the container-provided accelerator table, OleTranslateAccelerator passes the message and its command identifier on to the container through the IOleInPlaceFrame::TranslateAccelerator method. This method returns S_OK if the keystroke is consumed; otherwise it returns S_FALSE.

Accelerator tables for containers should be defined so they will work properly with object applications that do their own accelerator keystroke translations. These tables should take the form:

"char", wID, VIRTKEY, CONTROL

This is the most common way to describe keyboard accelerators. Failure to do so can result in keystrokes being lost or sent to the wrong object during an in-place session.

Objects can call the IsAccelerator function to see whether the accelerator keystroke belongs to the object or the container.

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 ole2.h
Library Ole32.lib
DLL Ole32.dll
API set ext-ms-win-com-ole32-l1-1-3 (introduced in Windows 10, version 10.0.10240)

See also

IOleInPlaceFrame::TranslateAccelerator

IsAccelerator