8.5.4 Modifying the WM_COMMAND Case

Child window controls notify the parent window of events by using a WM_COMMAND message. The wParam parameter of this message identifies the control that generated the message.

To recognize an out-of-memory notification from the edit control, add the following code to the WM_COMMAND case:

case IDC_EDIT:
    if (HIWORD(lParam) == EN_ERRSPACE) {
        MessageBox(
            GetFocus(),
            "Out of memory.",
            "EditCntl Sample Application",
            MB_ICONHAND | MB_OK);
    }
    break;