ID Number: Q78543
3.00
WINDOWS
Summary:
SYMPTOMS
The CreateDialog() or DialogBox() function fails to create a dialog
box with an edit control when at least 10 dialog boxes, each with
one or more edit controls, exist anywhere in the system.
CAUSE
When Windows creates a dialog box with one or more edit controls,
it calls the GlobalAlloc() function to allocate a block of global
memory. This memory is used as a data segment to hold the text
buffers for the edit controls. Due to a limitation of real mode,
Windows requires that the handle to the data segment is less than
0x2000. For this reason, Windows maintains a cache of 10 handles
less than 0x2000 to use if the handle returned by GlobalAlloc does
not meet this requirement. If GlobalAlloc returns a handle greater
than 0x2000 and all 10 of the cached handles are in use, then
Windows fails the CreateDialog or DialogBox call.
RESOLUTION
Specify the DS_LOCALEDIT style in the dialog box template, or
create the edit control explicitly with CreateWindow.
When an edit control has the DS_LOCALEDIT style, Windows does not
allocate global memory for the control's data segment. Instead, the
edit control uses the data segment of the hInstance variable
specified when the dialog box was created. If the application's
hInstance is passed to CreateDialog or DialogBox, the edit control
uses the application's data segment.
If the edit control is explicitly created with CreateWindow, it
will use the data segment pointed to by the hInstance passed to
CreateWindow.