# DM_SETFOCUS

The DM_SETFOCUS message sets the keyboard focus to the given dialog item.

### Param1

The ID of the dialog item that receives the input focus.

### Param2

0

### Return

FALSE - the given dialog item cannot receive the keyboard focus
TRUE - the focus has been set successfully.

### Controls

Control | Description
--- | ---
All | All items that can have keyboard input focus.

### Remarks

The DM_SETFOCUS spawns the following events: DN_KILLFOCUS for the element that loses focus and DN_GOTFOCUS for the element that gets focus. The DN_KILLFOCUS and DN_GOTFOCUS events are not generated when Param1 is equal to the item currently having focus.
See also:
DialogEx