CEdit::SetHandle

Syntax

void SetHandle( HANDLE hBuffer );

Parameters

hBuffer

Contains a handle to the local memory. This handle must have been cre-ated by a previous call to the LocalAlloc Windows function using the LMEM_MOVEABLE flag. The memory is assumed to contain a null-terminated string—if this is not the case, the first byte of the allocated memory should be set to 0.

Remarks

Sets the handle to the local memory that will be used by a multiple-line edit control. The edit control will then use this buffer to store the currently displayed text instead of allocating its own buffer.

This member function is only processed by multiple-line edit controls.

Before an application sets a new memory handle, it should use the GetHandle member function to get the handle to the current memory buffer and free that memory using the Windows LocalFree function.

SetHandle clears the undo buffer (the CanUndo member function then returns FALSE) and the internal modification flag (the GetModify member function then returns FALSE). The edit-control window will be redrawn.

You may use this member function in a multiple-line edit control in a dialog box only if you have created the dialog box with the DS_LOCALEDIT style flag set.

See Also

CEdit::CanUndo, CEdit::GetHandle, CEdit::GetModify, ::LocalAlloc, ::LocalFree, EM_SETHANDLE