# DM_ADDHISTORY

The DM_ADDHISTORY message is sent to the dialog manager to add an item to the history of a text input string.

### Param1

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

### Param2

Pointer to a NULL-terminated string to be added to the history.

### Return

`TRUE` - data was successfully added.
`FALSE` - the specified dialog item doesn't have a history.

### Controls

Control | Description
--- | ---
DI_EDIT | Text input string
DI_FIXEDIT | Fixed width text input string

### Remarks

The message applies only to the DI_EDIT and DI_FIXEDIT items with the DIF_HISTORY flag set. Also, if the DIF_MANUALADDHISTORY flag is not set, items will be added to the history automatically.

### Example

For example, in a calculator pressing Enter computes an expression. To save the entered expression to history after Enter was pressed it is necessary to get that string and add it to history:

    FarDialogItem dialog[] = {
    ...
      { DI_EDIT, 10, 3, 49, 0, 1, (int)"foo_history", DIF_HISTORY|DIF_MANUALADDHISTORY, 0, "" },
    ...
    };

    LONG_PTR WINAPI FooDlgProc(HANDLE hDlg, int Msg, int Param1, LONG_PTR Param2)
    {
    ...
        if (Msg == DM_KEY && Param2 == KEY_ENTER){
          Info.SendDlgMessage(hDlg, DM_GETTEXTPTR, 2, (LONG_PTR)Text);
          Info.SendDlgMessage(hDlg, DM_ADDHISTORY, 2, (LONG_PTR)Text);
          Res = AData.Parse(Text);
    ...
    }

See also:
DialogEx, DIF_HISTORY, DIF_MANUALADDHISTORY.