Edit Box

This is a discussion on Edit Box within the Windows Programming forums, part of the Platform Specific Boards category; You use the CallWindowProc function to call the old window procedure. This function should usually be called instead of DefWindowProc. ...

  1. #16
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You use the CallWindowProc function to call the old window procedure. This function should usually be called instead of DefWindowProc. The first argument, lpPrevWndFunc, should be the value returned by SetWindowLongPtr. Your window procedure should look something like this:
    Code:
    LRESULT CALLBACK WndProc( ... )
    {
        switch (uMsg)
        {
            case WM_ERASEBKGND:
            {
                 // do your stuff here...
            }
    
            default:
            {
                return CallWindowProc(oldWindowProc, hwnd, uMsg, lParam, wParam);
            }
        }
        return 0;
    }

  2. #17
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    Ok, now i got another problem.
    The thing you told anonytmouse works.
    But now i must use WM_PAINT message. If i do things there, then other WM_PAINT isn't executed.
    Where can i find the source of handling WM_PAINT for a RichEdit. I'm just gonna copy the source,
    and modify it a little bit... ( So that i Select my HBRUSH )
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  3. #18
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    , WM_ERASEBKGND works only when i select text in RichEdit. And still The BkMode is set to OPAQUE,
    that's why i'm going to play with WM_PAINT.
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  4. #19
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    I don't wanna search all the windows headers. Does someone knows where the WM_PAINT message
    for RichEdit is defined?

    I have somekind of thing that points to WndProc, but i don't know how could that be helpfull...
    Code:
    oldWindowProc
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  5. #20
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Windows is not open-source. The code for WM_PAINT for a rich-edit is not available. You can try calling the old window procedure before or after your extra processing but I'm not optimistic this will work. Even if you get it working on your platform, you should consider that the rich-edit implementation may be different on other platforms.

    I did a search and apparently rich-edit versions 2 and greater (make sure you are loading the correct DLL) support the WS_EX_TRANSPARENT extended style. You would use this style and display your background image in a control behind the rich-edit control.

    http://groups.google.com/group/borla...48987d4eae24bf
    http://home.att.net/~robertdunn/FAQs/Faqs.html#Bmk010
    http://www.codeproject.com/richedit/SemiRichEdit.asp

    There is also windowless rich-edit controls, although this would be far more complex to use.

  6. #21
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    Heres how my code looks like right now:
    Code:
           CreateWindowEx(WS_EX_TRANSPARENT, RICHEDIT_CLASS, NULL, 
    		WS_CHILD | ES_MULTILINE | WS_BORDER | WS_VSCROLL, 
    		10, 10, 500, 400, 
    		hWindow, (HMENU)(400), hinstance, NULL);
    - First i tryed to put WS_EX_TRANSPARENT, with other styles (WS_BORDER | WS_VSCROLL), but then i got
    RichEdit, which displays my text with "*", like a password field.

    - Then i moved the style above, like you can see in the code. Now it looked like it worked. But heres
    what happened.
    I put my drawing in WM_ERASEBKGND ( a single BitBlt ) In my window there is nothing but RichEdit.

    Problems that occured:
    - only current line of text is visible when i type text
    - the background isn't updated when i type so i got |||||| on the buffer ( | - typing cursor )
    - the background is updated only when i select text. and only current line. - wierd
    - The arrows of my scrollbar aren't displayed.
    - when i select text the text goes behind my bitmap, this works if i select multiple rows.

    It seems that i will never finish this...
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  7. #22
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    also i did this
    Code:
    LoadLibrary(TEXT("Riched20.dll"));
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  8. #23
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You will need to subclass the WM_CHAR message of the rich-edit and invalidate the parent window so that the background is repainted each time a character is received. There is an example here:
    Making a RichEdit see through

  9. #24
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    I quit this. It isn't worth all the trouble. I could easyer create my own RichEdit...
    Thanks for help everyone, especialy anonytmouse & Ken Fitlike.
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. edit box
    By beene in forum Windows Programming
    Replies: 3
    Last Post: 11-11-2006, 04:40 AM
  3. edit box affecting displaying of text?
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-04-2005, 04:28 PM
  4. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 09:34 PM
  5. display a file in dropdown edit box
    By sunburnbyRA in forum Windows Programming
    Replies: 2
    Last Post: 03-10-2004, 01:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21