Condividi tramite


CEdit::GetHandle

Call this function to retrieve a handle to the memory currently allocated for a multiple-line edit control.

HLOCAL GetHandle( ) const;

Return Value

A local memory handle that identifies the buffer holding the contents of the edit control. If an error occurs, such as sending the message to a single-line edit control, the return value is 0.

Remarks

The handle is a local memory handle and may be used by any of the Local Windows memory functions that take a local memory handle as a parameter.

GetHandle is processed only by multiple-line edit controls.

Call GetHandle for a multiple-line edit control in a dialog box only if the dialog box was created with the DS_LOCALEDIT style flag set. If the DS_LOCALEDIT style is not set, you will still get a nonzero return value, but you will not be able to use the returned value.

Nota

GetHandle will not work with Windows 95/98. If you call GetHandle in Windows 95/98, it will return NULL. GetHandle will work as documented under Windows NT, versions 3.51 and later.

For more information, see EM_GETHANDLE in the Windows SDK.

Example

HLOCAL h = m_myEdit.GetHandle();
LPCTSTR lpszText = (LPCTSTR) ::LocalLock(h);

// Dump the text of the edit control.
AFXDUMP(lpszText);

::LocalUnlock(h);

Requirements

Header: afxwin.h

See Also

Reference

CEdit Class

Hierarchy Chart

CEdit::SetHandle

Other Resources

CEdit Members