-        msStyle |= ES_AUTOHSCROLL;
-
-    if (m_windowStyle & wxHSCROLL)
-        msStyle |= (WS_HSCROLL | ES_AUTOHSCROLL);
-
-    if (m_windowStyle & wxTE_READONLY)
-        msStyle |= ES_READONLY;
-
-    if (m_windowStyle & wxHSCROLL)
-        msStyle |= (WS_HSCROLL | ES_AUTOHSCROLL);
-    if (m_windowStyle & wxTE_PASSWORD) // hidden input
-        msStyle |= ES_PASSWORD;
-
-    // we always want the characters and the arrows
-    m_lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
-
-    // we may have several different cases:
-    // 1. normal case: both TAB and ENTER are used for dialog navigation
-    // 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
-    //    control in the dialog
-    // 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
-    // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
-    //    the next control
-    if ( m_windowStyle & wxTE_PROCESS_ENTER )
-        m_lDlgCode |= DLGC_WANTMESSAGE;
-    if ( m_windowStyle & wxTE_PROCESS_TAB )
-        m_lDlgCode |= DLGC_WANTTAB;
-
-    // do create the control - either an EDIT or RICHEDIT
-    const wxChar *windowClass = wxT("EDIT");
-
-    bool want3D;
-    WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
-
-    // Even with extended styles, need to combine with WS_BORDER for them to
-    // look right.
-    if ( want3D || wxStyleHasBorder(m_windowStyle) )
-        msStyle |= WS_BORDER;
-
-    // NB: don't use pos and size as CreateWindowEx arguments because they
-    //     might be -1 in which case we should use the default values (and
-    //     SetSize called below takes care of it)
-    m_hWnd = (WXHWND)::CreateWindowEx(exStyle,
-                                      windowClass,
-                                      NULL,
-                                      msStyle,
-                                      0, 0, 0, 0,
-                                      GetHwndOf(parent),
-                                      (HMENU)m_windowId,
-                                      wxGetInstance(),
-                                      NULL);
-
-    wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create text ctrl") );
-*/
+    {
+        lSstyle |= ES_LEFT | ES_AUTOSCROLL | ES_MARGIN;
+
+        if (m_windowStyle & wxHSCROLL)
+            lSstyle |=  ES_AUTOSCROLL;
+        if (m_windowStyle & wxTE_READONLY)
+            lSstyle |= ES_READONLY;
+        if (m_windowStyle & wxTE_PASSWORD) // hidden input
+            lSstyle |= ES_UNREADABLE;
+    }
+    if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
+         pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
+       )
+        lSstyle |= WS_CLIPSIBLINGS;
+    if (m_bIsMLE)
+    {
+        m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
+                                           ,WC_MLE                   // Window class
+                                           ,(PSZ)rsValue.c_str()     // Initial Text
+                                           ,(ULONG)lSstyle           // Style flags
+                                           ,(LONG)0                  // X pos of origin
+                                           ,(LONG)0                  // Y pos of origin
+                                           ,(LONG)0                  // field width
+                                           ,(LONG)0                  // field height
+                                           ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
+                                           ,HWND_TOP                 // initial z position
+                                           ,(ULONG)vId               // Window identifier
+                                           ,NULL                     // no control data
+                                           ,NULL                     // no Presentation parameters
+                                          );
+    }
+    else
+    {
+        m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
+                                           ,WC_ENTRYFIELD            // Window class
+                                           ,(PSZ)rsValue.c_str()     // Initial Text
+                                           ,(ULONG)lSstyle           // Style flags
+                                           ,(LONG)0                  // X pos of origin
+                                           ,(LONG)0                  // Y pos of origin
+                                           ,(LONG)0                  // field width
+                                           ,(LONG)0                  // field height
+                                           ,(HWND)GetHwndOf(pParent) // owner window handle (same as parent
+                                           ,HWND_TOP                 // initial z position
+                                           ,(ULONG)vId               // Window identifier
+                                           ,NULL                     // no control data
+                                           ,NULL                     // no Presentation parameters
+                                          );
+    }
+
+    if (m_hWnd == 0)
+    {
+        return FALSE;
+    }
+