Compartir a través de


CComControlBase::SetControlFocus

Sets or removes the keyboard focus to or from the control.

BOOL SetControlFocus(
   BOOL bGrab 
);

Parameters

  • bGrab
    If TRUE, sets the keyboard focus to the calling control. If FALSE, removes the keyboard focus from the calling control, provided it has the focus.

Return Value

Returns TRUE if the control successfully receives focus; otherwise, FALSE.

Remarks

For a windowed control, the Windows API function SetFocus is called. For a windowless control, IOleInPlaceSiteWindowless::SetFocus is called. Through this call, a windowless control obtains the keyboard focus and can respond to window messages.

Requirements

Header: atlctl.h

See Also

Reference

CComControlBase Class

Other Resources

CComControlBase Members