An application sends an EM_SETHANDLE message to set the handle of the memory that will be used by a multiline edit control.
EM_SETHANDLE wParam = (WPARAM) (HLOCAL) hloc; // handle of memory buffer lParam = 0; // not used; must be zero
This message does not return a value.
Before an application sets a new memory handle, it should send an EM_GETHANDLE message to retrieve the handle of the current memory buffer and should free that memory.
An edit control automatically reallocates the given buffer whenever it needs additional space for text, or it removes enough text so that additional space is no longer needed.
Sending an EM_SETHANDLE message clears the undo buffer (EM_CANUNDO returns zero) and the internal modification flag (EM_GETMODIFY returns zero). The edit control window is redrawn.
An application can send this message to a multiline edit control in a dialog box only if it has created the dialog box with the DS_LOCALEDIT style flag set.