The following sample code fragment shows how to create an MLE by using WinCreateWindow:
#define MLE_WINDOW_ID 2 HWND hwndParent; HWND hwndMLE; hwndMLE = WinCreateWindow( hwndParent, /* Parent window */ WC_MLE, /* Window class */ "Test", /* Initial text */ WS_VISIBLE | /* Window style */ MLS_BORDER, /* Window style */ 100, 100, /* x and y positions */ 100, 100, /* Width and height */ hwndParent, /* Owner window */ HWND_TOP, /* Top of z-order */ MLE_WINDOW_ID, /* Identifier */ NULL, /* Control data */ NULL); /* Presparam */
It also is common to create an MLE field control by using an MLE statement in a dialog-window template in a resource file, as shown in the following code fragment:
MLE "", IDD_MLETEXT, 110, 10, 50, 100, WS_VISIBLE | MLS_BORDER | MLS_WORDWRAP
The predefined class for an MLE control is WC_MLE. If you do not specify a style for the MLE control, the default styles used are MLS_BORDER, WS_GROUP, and WS_TABSTOP.