implement EM_GETTEXTEX in riched20

Aric Stewart aric at codeweavers.com
Wed Jun 29 09:02:34 CDT 2005


implementation for EM_GETTEXTEX in riched20
-------------- next part --------------
Index: dlls/riched20/editor.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/editor.c,v
retrieving revision 1.32
diff -u -r1.32 editor.c
--- dlls/riched20/editor.c	21 Jun 2005 20:53:14 -0000	1.32
+++ dlls/riched20/editor.c	29 Jun 2005 14:00:17 -0000
@@ -845,7 +845,6 @@
   UNSUPPORTED_MSG(EM_GETRECT)
   UNSUPPORTED_MSG(EM_GETREDONAME)
   UNSUPPORTED_MSG(EM_GETSCROLLPOS)
-  UNSUPPORTED_MSG(EM_GETTEXTEX)
   UNSUPPORTED_MSG(EM_GETTEXTLENGTHEX)
   UNSUPPORTED_MSG(EM_GETTEXTMODE)
   UNSUPPORTED_MSG(EM_GETTYPOGRAPHYOPTIONS)
@@ -1184,6 +1183,30 @@
     return RichEditANSIWndProc(hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
   }
   case EM_GETSELTEXT:
+  case EM_GETTEXTEX:
+  {
+    GETTEXTEX *ex = (GETTEXTEX*)wParam;
+    
+    if (ex->flags != 0)
+        FIXME("Unhandled EM_GETTEXTEX flags 0x%lx\n",ex->flags);
+
+    if (IsWindowUnicode(hWnd))
+      return ME_GetTextW(editor, (LPWSTR)lParam, 0, ex->cb, FALSE);
+    else
+    {
+        LPWSTR buffer = HeapAlloc(GetProcessHeap(),0,ex->cb*sizeof(WCHAR));
+        DWORD buflen = ex->cb;
+        LRESULT rc;
+        DWORD flags = 0;
+
+        buflen = ME_GetTextW(editor, buffer, 0, buflen, FALSE);
+        rc = WideCharToMultiByte(ex->codepage, flags, buffer, buflen, (LPSTR)lParam, ex->cb, ex->lpDefaultChar, ex->lpUsedDefaultChar);
+
+        HeapFree(GetProcessHeap(),0,buffer);
+        return rc;
+    }
+  }
+
   {
     int from, to;
     TEXTRANGEW tr; /* W and A differ only by rng->lpstrText */


More information about the wine-patches mailing list