IOleInPlaceSiteWindowless::SetFocus  1S.I_LY

Sets the keyboard focus for a UI-active, windowless object.

HRESULT SetFocus(

    BOOL fFocus

//Set or release the keyboard focus

   );

 

 

Parameters

fFocus

[in] If TRUE, sets the keyboard focus to the calling object. If FALSE, removes the keyboard focus from the calling object, provided that the object has the focus.

 

Return Values

S_OK

Keyboard focus was successfully given to the object. If this method is called to release the focus, it should never fail.

S_FALSE

Keyboard focus was denied to the object.

 

Remarks

A windowless object calls this method whenever a windowed object would call the Windows API function SetFocus. Through this call, the windowless object obtains the keyboard focus and can respond to window messages. Normally, this call is made during the UI activation process and within the notification methods IOleInPlaceActiveObject::OnDocWindowActivate(TRUE) and IOleInPlaceActiveObject::OnFrameWindowActivate(TRUE).

In response to this call, the container sets the Windows focus to the window being used to get keyboard messages (usually the container window) and redirects any subsequent keyboard messages to the windowless object that requested the focus.

A windowless object also calls the IOleInPlaceSiteWindowless::SetFocus method with the fFocus parameter set to FALSE to release the keyboard focus without assigning it to any other object. In this case, the container must call the Windows API function SetFocus with a NULL parameter so that no window has the focus.

See Also

IOleInPlaceActiveObject