Search code examples
windowswinapisendmessageeditcontrol

Get maximum editor length that has been set by EM_LIMITTEXT


Text limit of an edit control could be set by sending EM_LIMITTEXT Windows message.

Is there some way to request this parameter from an edit control?


Solution

  • According to the EM_GETLIMITTEXT:

    Parameters

    wParam

    Not used; must be zero.

    lParam

    Not used; must be zero.

    Return value

    The return value is the text limit.

    So you can try the following code to get the Text limit:

    DWORD size = SendMessage(he, EM_GETLIMITTEXT, 0, 0);