Richedit

This is a discussion on Richedit within the Windows Programming forums, part of the Platform Specific Boards category; Im trying to get some Win32 API code to work using the Richedit control. From what i have understood, to ...

  1. #1
    Registered User steve_i83's Avatar
    Join Date
    Aug 2001
    Posts
    42

    Richedit

    Im trying to get some Win32 API code to work using the Richedit control. From what i have understood, to load text to the control you specify a callback function in an EDITSTREAM struct and then send the EM_STREAMIN message, but i cant get it too work.

    I want to load a string to the control, can someone give an example .. thxs
    C Rulz!

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    I am new to Windows programming but, try researching the function:

    SetDlgItemText

    I think that might work. Like I said, I'm new so excuse me if I'm wrong.

    --Garfield the Great
    1978 Silver Anniversary Corvette

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    SetDlgItemText(...) or SetWindowText(...) are what you're looking for...

    I always used to have the problem that when I tried using a riched it's crash, but I fixed it by calling

    LoadLibrary("RichEd32.dll"); on WM_CREATE

  4. #4
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    > I always used to have the problem that when I tried using a riched it's crash, but I fixed it by calling

    LoadLibrary("RichEd32.dll"); on WM_CREATE
    <

    Why did this fix it?

    --Garfield the Great
    1978 Silver Anniversary Corvette

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    18

    check this out !

    in order to add text to a richedit or simple edit you can use this :

    void AddTextTo(HWND win,char *text)
    {
    SendMessage(win,EM_SETSEL,-1,-1);
    SendMessage(win,EM_REPLACESEL,FALSE,(LPARAM)text);
    }

    void InsertTextTo(HWND win,char *text)
    {
    SendMessage(win,EM_REPLACESEL,FALSE,(LPARAM)text);
    }

    void InsertTextInpos(HWND win,char *text,int pos)
    {
    SendMessage(win,EM_SETSEL,pos,pos);
    SendMessage(win,EM_REPLACESEL,FALSE,(LPARAM)text);
    }

    and use this in order to make the richedit available in your programme in the WinMain :

    LoadLibrary("RICHED32.DLL");
    LoadLibrary("RICHED20.DLL");
    OleInitialize(NULL);
    CoInitialize(NULL);

    best of luck !
    Last edited by tomkat; 11-04-2001 at 04:44 AM.
    What would this world be without some1 to break into your comuter or crack your software !????

  6. #6
    Unregistered
    Guest
    thxs people , i already have the riched32.dll being loading at app start, and SetDlgItemText() works but not in the way i wanted (i want to append text aswell) but tomkats solution seems about right... ill try them all cprogramming.com boards rule for problem solving... im off to try some new stuff out

  7. #7
    Registered User steve_i83's Avatar
    Join Date
    Aug 2001
    Posts
    42
    hmmm for some reason i wasnt logged in for the above post... sorry...

    (i think it has todo with the fact i came from hotmail.com)
    C Rulz!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. RichEdit need help!!!
    By lucas4ce in forum Windows Programming
    Replies: 1
    Last Post: 08-21-2004, 02:27 PM
  2. Drawing on a RichEdit?
    By Sea Monster in forum Windows Programming
    Replies: 5
    Last Post: 12-30-2003, 01:17 PM
  3. multiline richedit scrolling issue
    By tyouk in forum Windows Programming
    Replies: 1
    Last Post: 11-03-2003, 04:59 AM
  4. Problems with my richedit...
    By tyouk in forum Windows Programming
    Replies: 2
    Last Post: 11-02-2003, 03:57 AM
  5. RichEdit Problem
    By dirkduck in forum Windows Programming
    Replies: 0
    Last Post: 07-24-2003, 05:50 PM

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