|
Allocating a Text Buffer
When Windows creates an edit control, it automatically creates a text buffer,
sets its initial size, and increases the size as necessary. The size can be up
to a predefined limit of approximately 32 kilobytes for single-line edit
controls. Because this limit can change, it is called a soft limit. An application
can set a hard limit to the buffer size by sending an EM_SETLIMITTEXT message to the edit control. If the buffer exceeds either limit, Windows
sends the application an EN_ERRSPACE message. An application can retrieve the current text limit by sending an EM_GETLIMITTEXT message.
Windows typically creates an edit control buffer in a dialog box, using memory
outside the application's data segment. An application can suppress this
default allocation behavior and create the buffer from its local heap by using the
DS_LOCALEDIT style when creating the edit control. An application that uses the
DS_LOCALEDIT style is responsible for all buffer allocations. To make the
initial allocation, an application can call the LocalAlloc function and pass the returned buffer handle to the edit control by sending
it an EM_SETHANDLE message. To make subsequent allocations (in response to an EN_ERRSPACE
message, for example), an application should save the current buffer content (if
necessary) and obtain a new buffer as follows:
- Retrieve the handle of the memory currently allocated for the text in a
multiline edit control by sending the control an EM_GETHANDLE message.
- Free the buffer by calling the LocalFree function.
- Obtain a new buffer (and buffer handle) by calling LocalAlloc.
- Give the buffer handle to Windows by sending the control an EM_SETHANDLE message.
The EM_SETHANDLE and EM_GETHANDLE messages apply only to multiline edit controls.
An application that uses the default allocation behavior (that is, does not
use the DS_LOCALEDIT style) must not send EM_SETHANDLE and EM_GETHANDLE messages
to the edit control.
Sending an EM_SETHANDLE message has several side effects: it clears the undo flag (making the EM_CANUNDO message return zero), it clears the modify flag (making the EM_GETMODIFY message return zero), and it redraws the edit control window.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|