IOleInPlaceSiteWindowless::SetFocus method (ocidl.h)
Sets the keyboard focus for a UI-active, windowless object.
Syntax
HRESULT SetFocus(
[in] BOOL fFocus
);
Parameters
[in] fFocus
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 value
This method returns S_OK if the keyboard focus was successfully given to the object. If this method is called to release the focus, it should never fail. Other possible return values include the following.
Return code | Description |
---|---|
|
Keyboard focus was denied to the object. |
Remarks
A windowless object calls this method whenever a windowed object would call the SetFocus function. 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 with TRUE and IOleInPlaceActiveObject::OnFrameWindowActivate with 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 SetFocus function with a NULL parameter so that no window has the focus.
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 | ocidl.h |