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
= NULL
;
46 /* LPSTR RICHED32_aSubclass = NULL; */
48 #define TRACE_EDIT_MSG32(str) \
50 "32 bit : " str ": hwnd=%p, wParam=%08x, lParam=%08x\n"\
52 hwnd, (UINT)wParam, (UINT)lParam)
55 /***********************************************************************
56 * DllMain [Internal] Initializes the internal 'RICHED32.DLL'.
59 * hinstDLL [I] handle to the DLL's instance
61 * lpvReserved [I] reserved, must be NULL
68 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
73 case DLL_PROCESS_ATTACH
:
74 /* create private heap */
75 RICHED32_hHeap
= HeapCreate (0, 0x10000, 0);
76 /* register the Rich Edit class */
80 case DLL_PROCESS_DETACH
:
81 /* unregister all common control classes */
82 RICHED32_Unregister ();
83 HeapDestroy (RICHED32_hHeap
);
84 RICHED32_hHeap
= NULL
;
90 /* Support routines for window procedure */
91 INT
RICHEDIT_GetTextRange(HWND hwnd
,TEXTRANGEA
*tr
);
92 INT
RICHEDIT_GetSelText(HWND hwnd
,LPSTR lpstrBuffer
);
98 * Window procedure of the RichEdit control.
101 static LRESULT WINAPI
RICHED32_WindowProc(HWND hwnd
, UINT uMsg
, WPARAM wParam
,
104 int RTFToBuffer(char* pBuffer
, int nBufferSize
);
108 static HWND hwndEdit
;
109 static HWND hwndParent
;
110 static char* rtfBuffer
;
114 TRACE("previous hwndEdit: %p hwndParent %p\n",hwndEdit
,hwndParent
);
115 hwndEdit
= GetWindow(hwnd
,GW_CHILD
);
116 TRACE("uMsg: 0x%x hwnd: %p hwndEdit: %p\n",uMsg
,hwnd
,hwndEdit
);
122 TRACE_EDIT_MSG32("WM_CREATE Passed to default");
123 DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
127 TRACE_EDIT_MSG32("WM_NCCREATE");
129 /* remove SCROLLBARS from the current window style */
130 hwndParent
= ((LPCREATESTRUCTA
) lParam
)->hwndParent
;
132 newstyle
= style
= ((LPCREATESTRUCTA
) lParam
)->style
;
133 newstyle
&= ~WS_HSCROLL
;
134 newstyle
&= ~WS_VSCROLL
;
135 newstyle
&= ~ES_AUTOHSCROLL
;
136 newstyle
&= ~ES_AUTOVSCROLL
;
137 SetWindowLongA(hwnd
,GWL_STYLE
, newstyle
);
139 TRACE("previous hwndEdit: %p\n",hwndEdit
);
140 hwndEdit
= CreateWindowA ("edit", ((LPCREATESTRUCTA
) lParam
)->lpszName
,
142 hwnd
, (HMENU
) ID_EDIT
,
143 ((LPCREATESTRUCTA
) lParam
)->hInstance
, NULL
) ;
144 TRACE("hwndEdit: %p hwnd: %p\n",hwndEdit
,hwnd
);
152 TRACE_EDIT_MSG32("WM_SETFOCUS");
153 SetFocus (hwndEdit
) ;
157 TRACE_EDIT_MSG32("WM_SIZE");
158 MoveWindow (hwndEdit
, 0, 0, LOWORD (lParam
), HIWORD (lParam
), TRUE
) ;
162 TRACE_EDIT_MSG32("WM_COMMAND");
163 switch(HIWORD(wParam
)) {
170 return SendMessageA(hwndParent
, WM_COMMAND
,
171 wParam
, (LPARAM
)(hwnd
));
175 MessageBoxA (hwnd
, "RichEdit control out of space.",
176 "ERROR", MB_OK
| MB_ICONSTOP
) ;
181 TRACE_EDIT_MSG32("EM_STREAMIN");
183 /* setup the RTF parser */
184 RTFSetEditStream(( EDITSTREAM
*)lParam
);
185 rtfFormat
= wParam
&(SF_TEXT
|SF_RTF
);
193 rtfBufferSize
= RTFToBuffer(NULL
, 0);
194 rtfBuffer
= HeapAlloc(RICHED32_hHeap
, 0,rtfBufferSize
*sizeof(char));
197 RTFToBuffer(rtfBuffer
, rtfBufferSize
);
198 SetWindowTextA(hwndEdit
,rtfBuffer
);
199 HeapFree(RICHED32_hHeap
, 0,rtfBuffer
);
202 WARN("Not enough memory for a allocating rtfBuffer\n");
206 /* Messages specific to Richedit controls */
208 case EM_AUTOURLDETECT
:
209 TRACE_EDIT_MSG32("EM_AUTOURLDETECT Ignored");
213 TRACE_EDIT_MSG32("EM_CANPASTE Ignored");
217 TRACE_EDIT_MSG32("EM_CANREDO Ignored");
221 TRACE_EDIT_MSG32("EM_DISPLAYBAND Ignored");
225 TRACE_EDIT_MSG32("EM_EXGETSEL -> EM_GETSEL");
226 cr
= (VOID
*) lParam
;
227 if (hwndEdit
) SendMessageA( hwndEdit
, EM_GETSEL
, (INT
)&cr
->cpMin
, (INT
)&cr
->cpMax
);
228 TRACE("cpMin: 0x%x cpMax: 0x%x\n",(INT
)cr
->cpMin
,(INT
)cr
->cpMax
);
233 DWORD limit
= lParam
;
234 TRACE_EDIT_MSG32("EM_EXLIMITTEXT");
239 return SendMessageA(hwndEdit
,EM_SETLIMITTEXT
,limit
,0);
242 case EM_EXLINEFROMCHAR
:
243 TRACE_EDIT_MSG32("EM_EXLINEFROMCHAR -> LINEFROMCHAR");
244 if (hwndEdit
) return SendMessageA( hwndEdit
, EM_LINEFROMCHAR
, lParam
, wParam
);
248 TRACE_EDIT_MSG32("EM_EXSETSEL -> EM_SETSEL");
249 cr
= (VOID
*) lParam
;
250 if (hwndEdit
) SendMessageA( hwndEdit
, EM_SETSEL
, cr
->cpMin
, cr
->cpMax
);
254 TRACE_EDIT_MSG32("EM_FINDTEXT Ignored");
258 TRACE_EDIT_MSG32("EM_FINDTEXTEX Ignored");
262 TRACE_EDIT_MSG32("EM_FINDTEXTEXW Ignored");
266 TRACE_EDIT_MSG32("EM_FINDTEXTW Ignored");
269 case EM_FINDWORDBREAK
:
270 TRACE_EDIT_MSG32("EM_FINDWORDBREAK Ignored");
274 TRACE_EDIT_MSG32("EM_FORMATRANGE Ignored");
277 case EM_GETAUTOURLDETECT
:
278 TRACE_EDIT_MSG32("EM_GETAUTOURLDETECT Ignored");
281 case EM_GETBIDIOPTIONS
:
282 TRACE_EDIT_MSG32("EM_GETBIDIOPTIONS Ignored");
285 case EM_GETCHARFORMAT
:
286 TRACE_EDIT_MSG32("EM_GETCHARFORMAT Ignored");
289 case EM_GETEDITSTYLE
:
290 TRACE_EDIT_MSG32("EM_GETEDITSTYLE Ignored");
293 case EM_GETEVENTMASK
:
294 TRACE_EDIT_MSG32("EM_GETEVENTMASK Ignored");
298 TRACE_EDIT_MSG32("EM_GETIMECOLOR Ignored");
301 case EM_GETIMECOMPMODE
:
302 TRACE_EDIT_MSG32("EM_GETIMECOMPMODE Ignored");
305 case EM_GETIMEOPTIONS
:
306 TRACE_EDIT_MSG32("EM_GETIMEOPTIONS Ignored");
309 case EM_GETLANGOPTIONS
:
310 TRACE_EDIT_MSG32("STUB: EM_GETLANGOPTIONS");
313 case EM_GETOLEINTERFACE
:
314 TRACE_EDIT_MSG32("EM_GETOLEINTERFACE Ignored");
318 TRACE_EDIT_MSG32("EM_GETOPTIONS Ignored");
321 case EM_GETPARAFORMAT
:
322 TRACE_EDIT_MSG32("EM_GETPARAFORMAT Ignored");
325 case EM_GETPUNCTUATION
:
326 TRACE_EDIT_MSG32("EM_GETPUNCTUATION Ignored");
330 TRACE_EDIT_MSG32("EM_GETREDONAME Ignored");
333 case EM_GETSCROLLPOS
:
334 TRACE_EDIT_MSG32("EM_GETSCROLLPOS Ignored");
338 TRACE_EDIT_MSG32("EM_GETSELTEXT");
339 return RICHEDIT_GetSelText(hwndEdit
,(void *)lParam
);
342 TRACE_EDIT_MSG32("EM_GETTEXTEX Ignored");
345 case EM_GETTEXTLENGTHEX
:
346 TRACE_EDIT_MSG32("EM_GETTEXTLENGTHEX Ignored");
350 TRACE_EDIT_MSG32("EM_GETTEXTMODE Ignored");
353 case EM_GETTEXTRANGE
:
354 TRACE_EDIT_MSG32("EM_GETTEXTRANGE");
355 return RICHEDIT_GetTextRange(hwndEdit
,(TEXTRANGEA
*)lParam
);
357 case EM_GETTYPOGRAPHYOPTIONS
:
358 TRACE_EDIT_MSG32("EM_GETTYPOGRAPHYOPTIONS Ignored");
362 TRACE_EDIT_MSG32("EM_GETUNDONAME Ignored");
365 case EM_GETWORDBREAKPROCEX
:
366 TRACE_EDIT_MSG32("EM_GETWORDBREAKPROCEX Ignored");
369 case EM_GETWORDWRAPMODE
:
370 TRACE_EDIT_MSG32("EM_GETWORDWRAPMODE Ignored");
374 TRACE_EDIT_MSG32("EM_GETZOOM Ignored");
377 case EM_HIDESELECTION
:
378 TRACE_EDIT_MSG32("EM_HIDESELECTION Ignored");
381 case EM_PASTESPECIAL
:
382 TRACE_EDIT_MSG32("EM_PASTESPECIAL Ignored");
385 case EM_RECONVERSION
:
386 TRACE_EDIT_MSG32("EM_RECONVERSION Ignored");
390 TRACE_EDIT_MSG32("EM_REDO Ignored");
393 case EM_REQUESTRESIZE
:
394 TRACE_EDIT_MSG32("EM_REQUESTRESIZE Ignored");
397 case EM_SELECTIONTYPE
:
398 TRACE_EDIT_MSG32("EM_SELECTIONTYPE Ignored");
401 case EM_SETBIDIOPTIONS
:
402 TRACE_EDIT_MSG32("EM_SETBIDIOPTIONS Ignored");
405 case EM_SETBKGNDCOLOR
:
406 TRACE_EDIT_MSG32("EM_SETBKGNDCOLOR Ignored");
409 case EM_SETCHARFORMAT
:
410 TRACE_EDIT_MSG32("EM_SETCHARFORMAT Ignored");
413 case EM_SETEDITSTYLE
:
414 TRACE_EDIT_MSG32("EM_SETEDITSTYLE Ignored");
417 case EM_SETEVENTMASK
:
418 TRACE_EDIT_MSG32("EM_SETEVENTMASK Ignored");
422 TRACE_EDIT_MSG32("EM_SETFONTSIZE Ignored");
426 TRACE_EDIT_MSG32("EM_SETIMECOLO Ignored");
429 case EM_SETIMEOPTIONS
:
430 TRACE_EDIT_MSG32("EM_SETIMEOPTIONS Ignored");
433 case EM_SETLANGOPTIONS
:
434 TRACE_EDIT_MSG32("EM_SETLANGOPTIONS Ignored");
437 case EM_SETOLECALLBACK
:
438 TRACE_EDIT_MSG32("EM_SETOLECALLBACK Ignored");
442 TRACE_EDIT_MSG32("EM_SETOPTIONS Ignored");
446 TRACE_EDIT_MSG32("EM_SETPALETTE Ignored");
449 case EM_SETPARAFORMAT
:
450 TRACE_EDIT_MSG32("EM_SETPARAFORMAT Ignored");
453 case EM_SETPUNCTUATION
:
454 TRACE_EDIT_MSG32("EM_SETPUNCTUATION Ignored");
457 case EM_SETSCROLLPOS
:
458 TRACE_EDIT_MSG32("EM_SETSCROLLPOS Ignored");
461 case EM_SETTARGETDEVICE
:
462 TRACE_EDIT_MSG32("EM_SETTARGETDEVICE Ignored");
466 TRACE_EDIT_MSG32("EM_SETTEXTEX Ignored");
470 TRACE_EDIT_MSG32("EM_SETTEXTMODE Ignored");
473 case EM_SETTYPOGRAPHYOPTIONS
:
474 TRACE_EDIT_MSG32("EM_SETTYPOGRAPHYOPTIONS Ignored");
477 case EM_SETUNDOLIMIT
:
478 TRACE_EDIT_MSG32("EM_SETUNDOLIMIT Ignored");
481 case EM_SETWORDBREAKPROCEX
:
482 TRACE_EDIT_MSG32("EM_SETWORDBREAKPROCEX Ignored");
485 case EM_SETWORDWRAPMODE
:
486 TRACE_EDIT_MSG32("EM_SETWORDWRAPMODE Ignored");
490 TRACE_EDIT_MSG32("EM_SETZOOM Ignored");
493 case EM_SHOWSCROLLBAR
:
494 TRACE_EDIT_MSG32("EM_SHOWSCROLLBAR Ignored");
497 case EM_STOPGROUPTYPING
:
498 TRACE_EDIT_MSG32("EM_STOPGROUPTYPING Ignored");
502 TRACE_EDIT_MSG32("EM_STREAMOUT Ignored");
505 /* Messages dispatched to the edit control */
507 TRACE_EDIT_MSG32("EM_CANUNDO Passed to edit control");
508 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
510 TRACE_EDIT_MSG32("EM_CHARFROMPOS Passed to edit control");
511 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
512 case EM_EMPTYUNDOBUFFER
:
513 TRACE_EDIT_MSG32("EM_EMPTYUNDOBUFFER Passed to edit control");
514 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
516 TRACE_EDIT_MSG32("EM_FMTLINES Passed to edit control");
517 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
518 case EM_GETFIRSTVISIBLELINE
:
519 TRACE_EDIT_MSG32("EM_GETFIRSTVISIBLELINE Passed to edit control");
520 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
522 TRACE_EDIT_MSG32("EM_GETHANDLE Passed to edit control");
523 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
524 /* case EM_GETIMESTATUS:*/
525 case EM_GETLIMITTEXT
:
526 TRACE_EDIT_MSG32("EM_GETLIMITTEXT Passed to edit control");
527 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
529 TRACE_EDIT_MSG32("EM_GETLINE Passed to edit control");
530 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
531 case EM_GETLINECOUNT
:
532 TRACE_EDIT_MSG32("EM_GETLINECOUNT Passed to edit control");
533 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
535 TRACE_EDIT_MSG32("EM_GETMARGINS Passed to edit control");
536 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
538 TRACE_EDIT_MSG32("EM_GETMODIFY Passed to edit control");
539 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
540 case EM_GETPASSWORDCHAR
:
541 TRACE_EDIT_MSG32("EM_GETPASSWORDCHAR Passed to edit control");
542 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
544 TRACE_EDIT_MSG32("EM_GETRECT Passed to edit control");
545 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
547 TRACE_EDIT_MSG32("EM_GETSEL Passed to edit control");
548 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
550 TRACE_EDIT_MSG32("EM_GETTHUMB Passed to edit control");
551 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
552 case EM_GETWORDBREAKPROC
:
553 TRACE_EDIT_MSG32("EM_GETWORDBREAKPROC Passed to edit control");
554 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
555 case EM_LINEFROMCHAR
:
556 TRACE_EDIT_MSG32("EM_LINEFROMCHAR Passed to edit control");
557 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
559 TRACE_EDIT_MSG32("EM_LINEINDEX Passed to edit control");
560 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
562 TRACE_EDIT_MSG32("EM_LINELENGTH Passed to edit control");
563 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
565 TRACE_EDIT_MSG32("EM_LINESCROLL Passed to edit control");
566 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
568 TRACE_EDIT_MSG32("EM_POSFROMCHAR Passed to edit control");
569 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
571 TRACE_EDIT_MSG32("case EM_REPLACESEL Passed to edit control");
572 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
574 TRACE_EDIT_MSG32("case EM_SCROLL Passed to edit control");
575 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
577 TRACE_EDIT_MSG32("EM_SCROLLCARET Passed to edit control");
578 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
580 TRACE_EDIT_MSG32("EM_SETHANDLE Passed to edit control");
581 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
582 /* case EM_SETIMESTATUS:*/
583 case EM_SETLIMITTEXT
:
584 TRACE_EDIT_MSG32("EM_SETLIMITTEXT Passed to edit control");
585 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
587 TRACE_EDIT_MSG32("case EM_SETMARGINS Passed to edit control");
588 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
590 TRACE_EDIT_MSG32("EM_SETMODIFY Passed to edit control");
591 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
592 case EM_SETPASSWORDCHAR
:
593 TRACE_EDIT_MSG32("EM_SETPASSWORDCHAR Passed to edit control");
594 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
596 TRACE_EDIT_MSG32("EM_SETREADONLY Passed to edit control");
597 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
599 TRACE_EDIT_MSG32("EM_SETRECT Passed to edit control");
600 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
602 TRACE_EDIT_MSG32("EM_SETRECTNP Passed to edit control");
603 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
605 TRACE_EDIT_MSG32("EM_SETSEL Passed to edit control");
606 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
608 TRACE_EDIT_MSG32("EM_SETTABSTOPS Passed to edit control");
609 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
610 case EM_SETWORDBREAKPROC
:
611 TRACE_EDIT_MSG32("EM_SETWORDBREAKPROC Passed to edit control");
612 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
614 TRACE_EDIT_MSG32("EM_UNDO Passed to edit control");
615 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
617 case WM_STYLECHANGING
:
618 TRACE_EDIT_MSG32("WM_STYLECHANGING Passed to edit control");
619 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
620 case WM_STYLECHANGED
:
621 TRACE_EDIT_MSG32("WM_STYLECHANGED Passed to edit control");
622 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
624 TRACE_EDIT_MSG32("WM_GETTEXT Passed to edit control");
625 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
626 case WM_GETTEXTLENGTH
:
627 TRACE_EDIT_MSG32("WM_GETTEXTLENGTH Passed to edit control");
628 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
630 TRACE_EDIT_MSG32("WM_SETTEXT Passed to edit control");
631 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
633 TRACE_EDIT_MSG32("WM_CUT Passed to edit control");
634 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
636 TRACE_EDIT_MSG32("WM_COPY Passed to edit control");
637 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
639 TRACE_EDIT_MSG32("WM_PASTE Passed to edit control");
640 return SendMessageA( hwndEdit
, uMsg
, wParam
, lParam
);
642 /* Messages passed to default handler. */
644 /* A fundamental problem with embedding an edit control within another
645 window to emulate the richedit control, is that normally, the
646 WM_NCCALCSIZE message window would return the client area of the
649 While we could send a message to the edit control here to get that size
650 and return that value, this causes problems with the WM_SIZE message.
651 That is because the WM_SIZE message uses the returned value of
652 WM_NCCALCSIZE (via X11DRV_SetWindowSize) to determine the size to make
653 the edit control. If we return the size of the edit control client area
654 here, the result is the symptom of the edit control being inset on the
655 right and bottom by the width of any existing scrollbars.
657 The easy fix is to have WM_NCCALCSIZE return the true size of this
658 enclosing window, which is what we have done here. The more difficult
659 fix is to create a custom Richedit MoveWindow procedure for use in the
660 WM_SIZE message above. Since it is very unlikely that an app would call
661 and use the WM_NCCALCSIZE message, we stick with the easy fix for now.
663 TRACE_EDIT_MSG32("WM_NCCALCSIZE Passed to default");
664 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
666 TRACE_EDIT_MSG32("WM_NCPAINT Passed to default");
667 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
669 TRACE_EDIT_MSG32("WM_PAINT Passed to default");
670 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
672 TRACE_EDIT_MSG32("WM_ERASEBKGND Passed to default");
673 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
675 TRACE_EDIT_MSG32("WM_KILLFOCUS Passed to default");
676 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
678 TRACE_EDIT_MSG32("WM_DESTROY Passed to default");
679 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
680 case WM_CHILDACTIVATE
:
681 TRACE_EDIT_MSG32("WM_CHILDACTIVATE Passed to default");
682 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
684 case WM_WINDOWPOSCHANGING
:
685 TRACE_EDIT_MSG32("WM_WINDOWPOSCHANGING Passed to default");
686 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
687 case WM_WINDOWPOSCHANGED
:
688 TRACE_EDIT_MSG32("WM_WINDOWPOSCHANGED Passed to default");
689 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
690 /* case WM_INITIALUPDATE:
691 TRACE_EDIT_MSG32("WM_INITIALUPDATE Passed to default");
692 return DefWindowProcA( hwnd,uMsg,wParam,lParam); */
693 case WM_CTLCOLOREDIT
:
694 TRACE_EDIT_MSG32("WM_CTLCOLOREDIT Passed to default");
695 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
697 TRACE_EDIT_MSG32("WM_SETCURSOR Passed to default");
698 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
700 TRACE_EDIT_MSG32("WM_MOVE Passed to default");
701 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
703 TRACE_EDIT_MSG32("WM_SHOWWINDOW Passed to default");
704 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
705 case WM_PARENTNOTIFY
:
706 TRACE_EDIT_MSG32("WM_PARENTNOTIFY Passed to default");
707 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
709 TRACE_EDIT_MSG32("WM_SETREDRAW Passed to default");
710 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
712 TRACE_EDIT_MSG32("WM_NCDESTROY Passed to default");
713 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
715 TRACE_EDIT_MSG32("WM_NCHITTEST Passed to default");
716 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
717 case WM_CTLCOLORSTATIC
:
718 TRACE_EDIT_MSG32("WM_CTLCOLORSTATIC Passed to default");
719 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
721 TRACE_EDIT_MSG32("WM_NCMOUSEMOVE Passed to default");
722 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
724 TRACE_EDIT_MSG32("WM_CLEAR Passed to default");
725 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
727 * used by IE in the EULA box
729 case WM_ALTTABACTIVE
:
730 TRACE_EDIT_MSG32("WM_ALTTABACTIVE");
731 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
733 TRACE_EDIT_MSG32("WM_GETDLGCODE");
734 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
736 TRACE_EDIT_MSG32("WM_SETFONT");
737 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
741 if ((uMsg
>= WM_USER
) && (uMsg
< WM_APP
)) {
742 FIXME("Unknown message 0x%x Passed to default hwnd=%p, wParam=%08x, lParam=%08x\n",
743 uMsg
, hwnd
, (UINT
)wParam
, (UINT
)lParam
);
746 return DefWindowProcA( hwnd
,uMsg
,wParam
,lParam
);
749 /***********************************************************************
750 * DllGetVersion [RICHED32.2]
752 * Retrieves version information of the 'RICHED32.DLL'
755 * pdvi [O] pointer to version information structure.
759 * Failure: E_INVALIDARG
762 * Returns version of a comctl32.dll from IE4.01 SP1.
766 RICHED32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
770 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
)) {
775 pdvi
->dwMajorVersion
= 4;
776 pdvi
->dwMinorVersion
= 0;
777 pdvi
->dwBuildNumber
= 0;
778 pdvi
->dwPlatformID
= 0;
785 * Registers the window class.
793 VOID
RICHED32_Register(void)
799 ZeroMemory(&wndClass
, sizeof(WNDCLASSA
));
800 wndClass
.style
= CS_HREDRAW
| CS_VREDRAW
| CS_GLOBALCLASS
;
801 wndClass
.lpfnWndProc
= (WNDPROC
)RICHED32_WindowProc
;
802 wndClass
.cbClsExtra
= 0;
803 wndClass
.cbWndExtra
= 0; /*(sizeof(RICHED32_INFO *);*/
804 wndClass
.hCursor
= LoadCursorA(0, IDC_ARROWA
);
805 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
806 wndClass
.lpszClassName
= RICHEDIT_CLASS10A
; /* WC_RICHED32A; */
808 RegisterClassA (&wndClass
);
813 * Unregisters the window class.
821 VOID
RICHED32_Unregister(void)
825 UnregisterClassA(RICHEDIT_CLASS10A
, NULL
);
828 INT
RICHEDIT_GetTextRange(HWND hwnd
,TEXTRANGEA
*tr
)
830 UINT alloc_size
, text_size
, range_size
;
833 TRACE("start: 0x%x stop: 0x%x\n",(INT
)tr
->chrg
.cpMin
,(INT
)tr
->chrg
.cpMax
);
835 if (!(alloc_size
= SendMessageA(hwnd
,WM_GETTEXTLENGTH
,0,0))) return FALSE
;
836 if (!(text
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (alloc_size
+1))))
838 text_size
= SendMessageA(hwnd
,WM_GETTEXT
,alloc_size
,(INT
)text
);
840 if (text_size
> tr
->chrg
.cpMin
)
842 range_size
= (text_size
> tr
->chrg
.cpMax
) ? (tr
->chrg
.cpMax
- tr
->chrg
.cpMin
) : (text_size
- tr
->chrg
.cpMin
);
843 TRACE("EditText: %.30s ...\n",text
+tr
->chrg
.cpMin
);
844 memcpy(tr
->lpstrText
,text
+tr
->chrg
.cpMin
,range_size
);
847 HeapFree(GetProcessHeap(), 0, text
);
852 INT
RICHEDIT_GetSelText(HWND hwnd
,LPSTR lpstrBuffer
)
854 TEXTRANGEA textrange
;
856 textrange
.lpstrText
= lpstrBuffer
;
857 SendMessageA(hwnd
,EM_GETSEL
,(INT
)&textrange
.chrg
.cpMin
,(INT
)&textrange
.chrg
.cpMax
);
858 return RICHEDIT_GetTextRange(hwnd
,&textrange
);