Most controls accept and process a variety of control messages, which are special messages that direct the control to carry out some task that is unique to the control. For example, the WM_GETTEXTLENGTH message directs an edit control to return the length of a selected line of text.
To send a control message to a control, use the SendMessage function. Supply the message number and any required wParam and lParam parameter values. For example, the following statement sends the WM_GETTEXTLENGTH message to the edit control identified by the handle hEditWnd; it then returns the length of the selected line in the edit control:
nLength = SendMessage(hEditWnd, WM_GETTEXTLENGTH, 0, 0L);
Many controls also process standard window messages, such as WM_HSCROLL and WM_VSCROLL. To send such messages to controls, use the same method you use to send control messages.