4 * This module is a simple wrapper for the edit controls.
5 * At the point, it is good only for application who use the RICHEDIT
6 * control to display RTF text.
8 * Copyright 2000 by Jean-Claude Batista
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #define NO_SHLWAPI_STREAM
39 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
45 HANDLE RICHED32_hHeap = (HANDLE)NULL;
46 /* LPSTR RICHED32_aSubclass = (LPSTR)NULL; */
48 #define DPRINTF_EDIT_MSG32(str) \
50 "32 bit : " str ": hwnd=%08x, wParam=%08x, lParam=%08x\n"\
52 hwnd, (UINT)wParam, (UINT)lParam)
55 /***********************************************************************
56 * RICHED32_LibMain [Internal] Initializes the internal 'RICHED32.DLL'.
59 * hinstDLL [I] handle to the DLL's instance
61 * lpvReserved [I] reserved, must be NULL
69 RICHED32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
74 case DLL_PROCESS_ATTACH:
75 /* create private heap */
76 RICHED32_hHeap = HeapCreate (0, 0x10000, 0);
77 /* register the Rich Edit class */
81 case DLL_PROCESS_DETACH:
82 /* unregister all common control classes */
83 RICHED32_Unregister ();
84 HeapDestroy (RICHED32_hHeap);
85 RICHED32_hHeap = (HANDLE)NULL;
91 /* Support routines for window procedure */
92 INT RICHEDIT_GetTextRange(HWND hwnd,TEXTRANGEA *tr);
93 INT RICHEDIT_GetSelText(HWND hwnd,LPSTR lpstrBuffer);
99 * Window procedure of the RichEdit control.
102 static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
105 int RTFToBuffer(char* pBuffer, int nBufferSize);
109 static HWND hwndEdit;
110 static HWND hwndParent;
111 static char* rtfBuffer;
115 TRACE("previous hwndEdit: 0x%x hwndParent 0x%x\n",hwndEdit,hwndParent);
116 hwndEdit = GetWindow(hwnd,GW_CHILD);
117 TRACE("uMsg: 0x%x hwnd: 0x%x hwndEdit: 0x%x\n",uMsg,hwnd,hwndEdit);
123 DPRINTF_EDIT_MSG32("WM_CREATE");
125 /* remove SCROLLBARS from the current window style */
126 hwndParent = ((LPCREATESTRUCTA) lParam)->hwndParent;
128 newstyle = style = ((LPCREATESTRUCTA) lParam)->style;
129 newstyle &= ~WS_HSCROLL;
130 newstyle &= ~WS_VSCROLL;
131 newstyle &= ~ES_AUTOHSCROLL;
132 newstyle &= ~ES_AUTOVSCROLL;
134 TRACE("previous hwndEdit: 0x%d\n",hwndEdit);
135 hwndEdit = CreateWindowA ("edit", ((LPCREATESTRUCTA) lParam)->lpszName,
137 hwnd, (HMENU) ID_EDIT,
138 ((LPCREATESTRUCTA) lParam)->hInstance, NULL) ;
139 TRACE("hwndEdit: 0x%x hwnd: 0x%x\n",hwndEdit,hwnd);
141 SetWindowLongA(hwnd,GWL_STYLE, newstyle);
145 DPRINTF_EDIT_MSG32("WM_SETFOCUS");
146 SetFocus (hwndEdit) ;
150 DPRINTF_EDIT_MSG32("WM_SIZE");
151 MoveWindow (hwndEdit, 0, 0, LOWORD (lParam), HIWORD (lParam), TRUE) ;
155 DPRINTF_EDIT_MSG32("WM_COMMAND");
156 switch(HIWORD(wParam)) {
163 return SendMessageA(hwndParent, WM_COMMAND,
164 wParam, (LPARAM)(hwnd));
168 MessageBoxA (hwnd, "RichEdit control out of space.",
169 "ERROR", MB_OK | MB_ICONSTOP) ;
174 DPRINTF_EDIT_MSG32("EM_STREAMIN");
176 /* setup the RTF parser */
177 RTFSetEditStream(( EDITSTREAM*)lParam);
185 rtfBufferSize = RTFToBuffer(NULL, 0);
186 rtfBuffer = HeapAlloc(RICHED32_hHeap, 0,rtfBufferSize*sizeof(char));
189 RTFToBuffer(rtfBuffer, rtfBufferSize);
190 SetWindowTextA(hwndEdit,rtfBuffer);
191 HeapFree(RICHED32_hHeap, 0,rtfBuffer);
194 WARN("Not enough memory for a allocating rtfBuffer\n");
198 /* Messages specific to Richedit controls */
200 case EM_AUTOURLDETECT:
201 DPRINTF_EDIT_MSG32("EM_AUTOURLDETECT Ignored");
205 DPRINTF_EDIT_MSG32("EM_CANPASTE Ignored");
209 DPRINTF_EDIT_MSG32("EM_CANREDO Ignored");
213 DPRINTF_EDIT_MSG32("EM_DISPLAYBAND Ignored");
217 DPRINTF_EDIT_MSG32("EM_EXGETSEL -> EM_GETSEL");
218 cr = (VOID *) lParam;
219 if (hwndEdit) SendMessageA( hwndEdit, EM_GETSEL, (INT)&cr->cpMin, (INT)&cr->cpMax);
220 TRACE("cpMin: 0x%x cpMax: 0x%x\n",(INT)cr->cpMin,(INT)cr->cpMax);
224 DPRINTF_EDIT_MSG32("EM_EXLIMITTEXT Ignored");
227 case EM_EXLINEFROMCHAR:
228 DPRINTF_EDIT_MSG32("EM_EXLINEFROMCHAR -> LINEFROMCHAR");
229 if (hwndEdit) return SendMessageA( hwndEdit, EM_LINEFROMCHAR, lParam, wParam);
233 DPRINTF_EDIT_MSG32("EM_EXSETSEL -> EM_SETSEL");
234 cr = (VOID *) lParam;
235 if (hwndEdit) SendMessageA( hwndEdit, EM_SETSEL, cr->cpMin, cr->cpMax);
239 DPRINTF_EDIT_MSG32("EM_FINDTEXT Ignored");
243 DPRINTF_EDIT_MSG32("EM_FINDTEXTEX Ignored");
247 DPRINTF_EDIT_MSG32("EM_FINDTEXTEXW Ignored");
251 DPRINTF_EDIT_MSG32("EM_FINDTEXTW Ignored");
254 case EM_FINDWORDBREAK:
255 DPRINTF_EDIT_MSG32("EM_FINDWORDBREAK Ignored");
259 DPRINTF_EDIT_MSG32("EM_FORMATRANGE Ignored");
262 case EM_GETAUTOURLDETECT:
263 DPRINTF_EDIT_MSG32("EM_GETAUTOURLDETECT Ignored");
266 case EM_GETBIDIOPTIONS:
267 DPRINTF_EDIT_MSG32("EM_GETBIDIOPTIONS Ignored");
270 case EM_GETCHARFORMAT:
271 DPRINTF_EDIT_MSG32("EM_GETCHARFORMAT Ignored");
274 case EM_GETEDITSTYLE:
275 DPRINTF_EDIT_MSG32("EM_GETEDITSTYLE Ignored");
278 case EM_GETEVENTMASK:
279 DPRINTF_EDIT_MSG32("EM_GETEVENTMASK Ignored");
283 DPRINTF_EDIT_MSG32("EM_GETIMECOLOR Ignored");
286 case EM_GETIMECOMPMODE:
287 DPRINTF_EDIT_MSG32("EM_GETIMECOMPMODE Ignored");
290 case EM_GETIMEOPTIONS:
291 DPRINTF_EDIT_MSG32("EM_GETIMEOPTIONS Ignored");
294 case EM_GETLANGOPTIONS:
295 DPRINTF_EDIT_MSG32("EM_GETLANGOPTIONS");
298 case EM_GETOLEINTERFACE:
299 DPRINTF_EDIT_MSG32("EM_GETOLEINTERFACE Ignored");
303 DPRINTF_EDIT_MSG32("EM_GETOPTIONS Ignored");
306 case EM_GETPARAFORMAT:
307 DPRINTF_EDIT_MSG32("EM_GETPARAFORMAT Ignored");
310 case EM_GETPUNCTUATION:
311 DPRINTF_EDIT_MSG32("EM_GETPUNCTUATION Ignored");
315 DPRINTF_EDIT_MSG32("EM_GETREDONAME Ignored");
318 case EM_GETSCROLLPOS:
319 DPRINTF_EDIT_MSG32("EM_GETSCROLLPOS Ignored");
323 DPRINTF_EDIT_MSG32("EM_GETSELTEXT");
324 return RICHEDIT_GetSelText(hwndEdit,(void *)lParam);
327 DPRINTF_EDIT_MSG32("EM_GETTEXTEX Ignored");
330 case EM_GETTEXTLENGTHEX:
331 DPRINTF_EDIT_MSG32("EM_GETTEXTLENGTHEX Ignored");
335 DPRINTF_EDIT_MSG32("EM_GETTEXTMODE Ignored");
338 case EM_GETTEXTRANGE:
339 DPRINTF_EDIT_MSG32("EM_GETTEXTRANGE");
340 return RICHEDIT_GetTextRange(hwndEdit,(TEXTRANGEA *)lParam);
342 case EM_GETTYPOGRAPHYOPTIONS:
343 DPRINTF_EDIT_MSG32("EM_GETTYPOGRAPHYOPTIONS Ignored");
347 DPRINTF_EDIT_MSG32("EM_GETUNDONAME Ignored");
350 case EM_GETWORDBREAKPROCEX:
351 DPRINTF_EDIT_MSG32("EM_GETWORDBREAKPROCEX Ignored");
354 case EM_GETWORDWRAPMODE:
355 DPRINTF_EDIT_MSG32("EM_GETWORDWRAPMODE Ignored");
359 DPRINTF_EDIT_MSG32("EM_GETZOOM Ignored");
362 case EM_HIDESELECTION:
363 DPRINTF_EDIT_MSG32("EM_HIDESELECTION Ignored");
366 case EM_PASTESPECIAL:
367 DPRINTF_EDIT_MSG32("EM_PASTESPECIAL Ignored");
370 case EM_RECONVERSION:
371 DPRINTF_EDIT_MSG32("EM_RECONVERSION Ignored");
375 DPRINTF_EDIT_MSG32("EM_REDO Ignored");
378 case EM_REQUESTRESIZE:
379 DPRINTF_EDIT_MSG32("EM_REQUESTRESIZE Ignored");
382 case EM_SELECTIONTYPE:
383 DPRINTF_EDIT_MSG32("EM_SELECTIONTYPE Ignored");
386 case EM_SETBIDIOPTIONS:
387 DPRINTF_EDIT_MSG32("EM_SETBIDIOPTIONS Ignored");
390 case EM_SETBKGNDCOLOR:
391 DPRINTF_EDIT_MSG32("EM_SETBKGNDCOLOR Ignored");
394 case EM_SETCHARFORMAT:
395 DPRINTF_EDIT_MSG32("EM_SETCHARFORMAT Ignored");
398 case EM_SETEDITSTYLE:
399 DPRINTF_EDIT_MSG32("EM_SETEDITSTYLE Ignored");
402 case EM_SETEVENTMASK:
403 DPRINTF_EDIT_MSG32("EM_SETEVENTMASK Ignored");
407 DPRINTF_EDIT_MSG32("EM_SETFONTSIZE Ignored");
411 DPRINTF_EDIT_MSG32("EM_SETIMECOLO Ignored");
414 case EM_SETIMEOPTIONS:
415 DPRINTF_EDIT_MSG32("EM_SETIMEOPTIONS Ignored");
418 case EM_SETLANGOPTIONS:
419 DPRINTF_EDIT_MSG32("EM_SETLANGOPTIONS Ignored");
422 case EM_SETOLECALLBACK:
423 DPRINTF_EDIT_MSG32("EM_SETOLECALLBACK Ignored");
427 DPRINTF_EDIT_MSG32("EM_SETOPTIONS Ignored");
431 DPRINTF_EDIT_MSG32("EM_SETPALETTE Ignored");
434 case EM_SETPARAFORMAT:
435 DPRINTF_EDIT_MSG32("EM_SETPARAFORMAT Ignored");
438 case EM_SETPUNCTUATION:
439 DPRINTF_EDIT_MSG32("EM_SETPUNCTUATION Ignored");
442 case EM_SETSCROLLPOS:
443 DPRINTF_EDIT_MSG32("EM_SETSCROLLPOS Ignored");
446 case EM_SETTARGETDEVICE:
447 DPRINTF_EDIT_MSG32("EM_SETTARGETDEVICE Ignored");
451 DPRINTF_EDIT_MSG32("EM_SETTEXTEX Ignored");
455 DPRINTF_EDIT_MSG32("EM_SETTEXTMODE Ignored");
458 case EM_SETTYPOGRAPHYOPTIONS:
459 DPRINTF_EDIT_MSG32("EM_SETTYPOGRAPHYOPTIONS Ignored");
462 case EM_SETUNDOLIMIT:
463 DPRINTF_EDIT_MSG32("EM_SETUNDOLIMIT Ignored");
466 case EM_SETWORDBREAKPROCEX:
467 DPRINTF_EDIT_MSG32("EM_SETWORDBREAKPROCEX Ignored");
470 case EM_SETWORDWRAPMODE:
471 DPRINTF_EDIT_MSG32("EM_SETWORDWRAPMODE Ignored");
475 DPRINTF_EDIT_MSG32("EM_SETZOOM Ignored");
478 case EM_SHOWSCROLLBAR:
479 DPRINTF_EDIT_MSG32("EM_SHOWSCROLLBAR Ignored");
482 case EM_STOPGROUPTYPING:
483 DPRINTF_EDIT_MSG32("EM_STOPGROUPTYPING Ignored");
487 DPRINTF_EDIT_MSG32("EM_STREAMOUT Ignored");
490 /* Messages dispatched to the edit control */
492 DPRINTF_EDIT_MSG32("EM_CANUNDO Passed to edit control");
493 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
495 DPRINTF_EDIT_MSG32("EM_CHARFROMPOS Passed to edit control");
496 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
497 case EM_EMPTYUNDOBUFFER:
498 DPRINTF_EDIT_MSG32("EM_EMPTYUNDOBUFFER Passed to edit control");
499 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
501 DPRINTF_EDIT_MSG32("EM_FMTLINES Passed to edit control");
502 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
503 case EM_GETFIRSTVISIBLELINE:
504 DPRINTF_EDIT_MSG32("EM_GETFIRSTVISIBLELINE Passed to edit control");
505 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
507 DPRINTF_EDIT_MSG32("EM_GETHANDLE Passed to edit control");
508 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
509 /* case EM_GETIMESTATUS:*/
510 case EM_GETLIMITTEXT:
511 DPRINTF_EDIT_MSG32("EM_GETLIMITTEXT Passed to edit control");
512 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
514 DPRINTF_EDIT_MSG32("EM_GETLINE Passed to edit control");
515 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
516 case EM_GETLINECOUNT:
517 DPRINTF_EDIT_MSG32("EM_GETLINECOUNT Passed to edit control");
518 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
520 DPRINTF_EDIT_MSG32("EM_GETMARGINS Passed to edit control");
521 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
523 DPRINTF_EDIT_MSG32("EM_GETMODIFY Passed to edit control");
524 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
525 case EM_GETPASSWORDCHAR:
526 DPRINTF_EDIT_MSG32("EM_GETPASSWORDCHAR Passed to edit control");
527 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
529 DPRINTF_EDIT_MSG32("EM_GETRECT Passed to edit control");
530 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
532 DPRINTF_EDIT_MSG32("EM_GETSEL Passed to edit control");
533 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
535 DPRINTF_EDIT_MSG32("EM_GETTHUMB Passed to edit control");
536 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
537 case EM_GETWORDBREAKPROC:
538 DPRINTF_EDIT_MSG32("EM_GETWORDBREAKPROC Passed to edit control");
539 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
540 case EM_LINEFROMCHAR:
541 DPRINTF_EDIT_MSG32("EM_LINEFROMCHAR Passed to edit control");
542 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
544 DPRINTF_EDIT_MSG32("EM_LINEINDEX Passed to edit control");
545 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
547 DPRINTF_EDIT_MSG32("EM_LINELENGTH Passed to edit control");
548 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
550 DPRINTF_EDIT_MSG32("EM_LINESCROLL Passed to edit control");
551 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
553 DPRINTF_EDIT_MSG32("EM_POSFROMCHAR Passed to edit control");
554 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
556 DPRINTF_EDIT_MSG32("case EM_REPLACESEL Passed to edit control");
557 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
559 DPRINTF_EDIT_MSG32("case EM_SCROLL Passed to edit control");
560 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
562 DPRINTF_EDIT_MSG32("EM_SCROLLCARET Passed to edit control");
563 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
565 DPRINTF_EDIT_MSG32("EM_SETHANDLE Passed to edit control");
566 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
567 /* case EM_SETIMESTATUS:*/
568 case EM_SETLIMITTEXT:
569 DPRINTF_EDIT_MSG32("EM_SETLIMITTEXT Passed to edit control");
570 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
572 DPRINTF_EDIT_MSG32("case EM_SETMARGINS Passed to edit control");
573 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
575 DPRINTF_EDIT_MSG32("EM_SETMODIFY Passed to edit control");
576 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
577 case EM_SETPASSWORDCHAR:
578 DPRINTF_EDIT_MSG32("EM_SETPASSWORDCHAR Passed to edit control");
579 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
581 DPRINTF_EDIT_MSG32("EM_SETREADONLY Passed to edit control");
582 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
584 DPRINTF_EDIT_MSG32("EM_SETRECT Passed to edit control");
585 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
587 DPRINTF_EDIT_MSG32("EM_SETRECTNP Passed to edit control");
588 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
590 DPRINTF_EDIT_MSG32("EM_SETSEL Passed to edit control");
591 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
593 DPRINTF_EDIT_MSG32("EM_SETTABSTOPS Passed to edit control");
594 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
595 case EM_SETWORDBREAKPROC:
596 DPRINTF_EDIT_MSG32("EM_SETWORDBREAKPROC Passed to edit control");
597 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
599 DPRINTF_EDIT_MSG32("EM_UNDO Passed to edit control");
600 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
602 case WM_STYLECHANGING:
603 DPRINTF_EDIT_MSG32("WM_STYLECHANGING Passed to edit control");
604 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
605 case WM_STYLECHANGED:
606 DPRINTF_EDIT_MSG32("WM_STYLECHANGED Passed to edit control");
607 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
609 DPRINTF_EDIT_MSG32("WM_NCCALCSIZE Passed to edit control");
610 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
612 DPRINTF_EDIT_MSG32("WM_GETTEXT Passed to edit control");
613 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
614 case WM_GETTEXTLENGTH:
615 DPRINTF_EDIT_MSG32("WM_GETTEXTLENGTH Passed to edit control");
616 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
618 DPRINTF_EDIT_MSG32("WM_SETTEXT Passed to edit control");
619 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
621 DPRINTF_EDIT_MSG32("WM_CUT Passed to edit control");
622 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
624 DPRINTF_EDIT_MSG32("WM_COPY Passed to edit control");
625 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
627 DPRINTF_EDIT_MSG32("WM_PASTE Passed to edit control");
628 return SendMessageA( hwndEdit, uMsg, wParam, lParam);
630 /* Messages passed to default handler. */
632 DPRINTF_EDIT_MSG32("WM_NCPAINT Passed to default");
633 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
635 DPRINTF_EDIT_MSG32("WM_PAINT Passed to default");
636 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
638 DPRINTF_EDIT_MSG32("WM_ERASEBKGND Passed to default");
639 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
641 DPRINTF_EDIT_MSG32("WM_KILLFOCUS Passed to default");
642 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
644 DPRINTF_EDIT_MSG32("WM_DESTROY Passed to default");
645 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
646 case WM_CHILDACTIVATE:
647 DPRINTF_EDIT_MSG32("WM_CHILDACTIVATE Passed to default");
648 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
650 case WM_WINDOWPOSCHANGING:
651 DPRINTF_EDIT_MSG32("WM_WINDOWPOSCHANGING Passed to default");
652 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
653 case WM_WINDOWPOSCHANGED:
654 DPRINTF_EDIT_MSG32("WM_WINDOWPOSCHANGED Passed to default");
655 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
656 /* case WM_INITIALUPDATE:
657 DPRINTF_EDIT_MSG32("WM_INITIALUPDATE Passed to default");
658 return DefWindowProcA( hwnd,uMsg,wParam,lParam); */
659 case WM_CTLCOLOREDIT:
660 DPRINTF_EDIT_MSG32("WM_CTLCOLOREDIT Passed to default");
661 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
663 DPRINTF_EDIT_MSG32("WM_SETCURSOR Passed to default");
664 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
666 DPRINTF_EDIT_MSG32("WM_MOVE Passed to default");
667 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
669 DPRINTF_EDIT_MSG32("WM_SHOWWINDOW Passed to default");
670 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
672 DPRINTF_EDIT_MSG32("WM_NCCREATE Passed to default");
673 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
674 case WM_PARENTNOTIFY:
675 DPRINTF_EDIT_MSG32("WM_PARENTNOTIFY Passed to default");
676 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
678 DPRINTF_EDIT_MSG32("WM_SETREDRAW Passed to default");
679 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
681 DPRINTF_EDIT_MSG32("WM_NCDESTROY Passed to default");
682 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
684 DPRINTF_EDIT_MSG32("WM_NCHITTEST Passed to default");
685 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
686 case WM_CTLCOLORSTATIC:
687 DPRINTF_EDIT_MSG32("WM_CTLCOLORSTATIC Passed to default");
688 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
690 DPRINTF_EDIT_MSG32("WM_NCMOUSEMOVE Passed to default");
691 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
693 DPRINTF_EDIT_MSG32("WM_CLEAR Passed to default");
694 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
698 FIXME("Unknown message 0x%x Passed to default hwnd=%08x, wParam=%08x, lParam=%08x\n",
699 uMsg, hwnd, (UINT)wParam, (UINT)lParam);
701 return DefWindowProcA( hwnd,uMsg,wParam,lParam);
704 /***********************************************************************
705 * DllGetVersion [RICHED32.2]
707 * Retrieves version information of the 'RICHED32.DLL'
710 * pdvi [O] pointer to version information structure.
714 * Failure: E_INVALIDARG
717 * Returns version of a comctl32.dll from IE4.01 SP1.
721 RICHED32_DllGetVersion (DLLVERSIONINFO *pdvi)
725 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
730 pdvi->dwMajorVersion = 4;
731 pdvi->dwMinorVersion = 0;
732 pdvi->dwBuildNumber = 0;
733 pdvi->dwPlatformID = 0;
740 * Registers the window class.
748 VOID RICHED32_Register(void)
754 ZeroMemory(&wndClass, sizeof(WNDCLASSA));
755 wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
756 wndClass.lpfnWndProc = (WNDPROC)RICHED32_WindowProc;
757 wndClass.cbClsExtra = 0;
758 wndClass.cbWndExtra = 0; /*(sizeof(RICHED32_INFO *);*/
759 wndClass.hCursor = LoadCursorA(0, IDC_ARROWA);
760 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
761 wndClass.lpszClassName = RICHEDIT_CLASS10A;//WC_RICHED32A;
763 RegisterClassA (&wndClass);
768 * Unregisters the window class.
776 VOID RICHED32_Unregister(void)
780 UnregisterClassA(RICHEDIT_CLASS10A, (HINSTANCE)NULL);
783 INT RICHEDIT_GetTextRange(HWND hwnd,TEXTRANGEA *tr)
785 UINT alloc_size, text_size, range_size;
788 TRACE("start: 0x%x stop: 0x%x\n",(INT)tr->chrg.cpMin,(INT)tr->chrg.cpMax);
790 if (!(alloc_size = SendMessageA(hwnd,WM_GETTEXTLENGTH,0,0))) return FALSE;
791 if (!(text = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (alloc_size+1))))
793 text_size = SendMessageA(hwnd,WM_GETTEXT,alloc_size,(INT)text);
795 if (text_size > tr->chrg.cpMin)
797 range_size = (text_size> tr->chrg.cpMax) ? (tr->chrg.cpMax - tr->chrg.cpMin) : (text_size - tr->chrg.cpMin);
798 TRACE("EditText: %.30s ...\n",text+tr->chrg.cpMin);
799 memcpy(tr->lpstrText,text+tr->chrg.cpMin,range_size);
802 HeapFree(GetProcessHeap(), 0, text);
807 INT RICHEDIT_GetSelText(HWND hwnd,LPSTR lpstrBuffer)
809 TEXTRANGEA textrange;
811 textrange.lpstrText = lpstrBuffer;
812 SendMessageA(hwnd,EM_GETSEL,(INT)&textrange.chrg.cpMin,(INT)&textrange.chrg.cpMax);
813 return RICHEDIT_GetTextRange(hwnd,&textrange);