# DM_SETHISTORY

The DM_SETHISTORY allows to manage availability of history in edit lines.

### Param1

The ID of the dialog item for which the history is changed.

### Param2

Pointer to a string containing the history list ID, or `NULL`, if the history should be disabled.

### Return

`FALSE` - the dialog item specified in Param1 does not support history lists.
`TRUE` - the history has been assigned successfully.

### Controls

Control | Description
--- | ---
DI_EDIT | edit line
DI_FIXEDIT | fixed-size input field

### Remarks

If the edit line is empty and the flag DIF_USELASTHISTORY for the DI_EDIT item is set, FAR will automatically subsitute the first value from the history into an empty edit line.

### Example

Implementation of this message can be seen in MultiArc plugin sources.

This example sets history and empties edit line:

    ...
      else if(Msg == MAM_ARCSWITCHES)
      {
        static char SwHistoryName[NM];
        FSF.sprintf(SwHistoryName,"ArcSwitches\\%s",pdd->ArcFormat);
        Info.SendDlgMessage(hDlg,DM_SETHISTORY,4,(LONG_PTR)SwHistoryName);
        Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,4,(LONG_PTR)"");
      }
    ...

In order to make FAR substitute the first line from keys histiry the code should be rewritten in the following way:

    ...
      else if(Msg == MAM_ARCSWITCHES)
      {
        static char SwHistoryName[NM];
        FSF.sprintf(SwHistoryName,"ArcSwitches\\%s",pdd->ArcFormat);
        Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,4,(LONG_PTR)"");
        Info.SendDlgMessage(hDlg,DM_SETHISTORY,4,(LONG_PTR)SwHistoryName);
      }
    ...

The edit line is being emptied and the item history is set after.

See also:
DialogEx, DM_ADDHISTORY, DIF_HISTORY