OleTranslateAccelerator  V7KTTD

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

WINOLEAPI OleTranslateAccelerator(

    LPOLEINPLACEFRAME lpFrame,

//Pointer to send keystrokes

    LPOLEINPLACEFRAMEINFO lpFrameInfo,

//Pointer to accelerator table obtained from container

    LPMSG lpmsg

//Pointer to structure containing the keystroke

   );

 

 

Parameters

lpFrame

[in] Pointer to the IOleInPlaceFrame interface to which the keystroke might be sent.

lpFrameInfo

[in] Pointer to an OLEINPLACEFRAMEINFO1U0YZQN structure containing the accelerator table obtained from the container.

lpmsg

[in] Pointer to an MSG structure containing the keystroke.

 

Return Values

This function supports the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following:

S_OK

The keystroke was processed.

S_FALSE

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.

The OleTranslateAccelerator function is intended to be called only by local server applications and not by in-process servers. For objects managed by local servers, keyboard input goes directly to the server s message pump. If the object does not translate the key, OleTranslateAccelerator gives the container application an opportunity to do it. For objects managed by in-process servers, the keyboard input goes directly to the container s message pump.

 

Note  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.5DC_5 function to see whether the accelerator keystroke belongs to the object or the container.

See Also

IsAccelerator, IOleInPlaceFrame::TranslateAccelerator