Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic


Gets a handle of the memory currently allocated for a multiline edit control's text.



Not used; must be zero.


Not used; must be zero.

Return value

The return value is a memory handle identifying the buffer that holds the content of the edit control. If an error occurs, such as sending the message to a single-line edit control, the return value is zero.


If the function succeeds, the application can access the contents of the edit control by casting the return value to HLOCAL and passing it to LocalLock. LocalLock returns a pointer to a buffer that is a null-terminated array of CHARs or WCHARs, depending on whether an ANSI or Unicode function created the control. For example, if CreateWindowExA was used the buffer is an array of CHARs, but if CreateWindowExW was used the buffer is an array of WCHARs. The application may not change the contents of the buffer. To unlock the buffer, the application calls LocalUnlock before allowing the edit control to receive new messages.

Note  For Comctl32.dll version 6, the buffer always contains an array of WCHARs, regardless of whether an ANSI or Unicode function created the edit control. For more information on DLL versions, see Common Control Versions.

If your application cannot abide by the restrictions imposed by EM_GETHANDLE, use the GetWindowTextLength and GetWindowText functions to copy the contents of the edit control into an application-provided buffer.

Windows 95/98/Me: Although this message returns a nonzero value, the resulting value is not useful to a 32-bit application.

Rich Edit: The EM_GETHANDLE message is not supported. Rich edit controls do not store text as a simple array of characters.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Winuser.h (include Windows.h)

See also

Other Resources



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.