-
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
-
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
-
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
-
> 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
-
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 !:cool:
-
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
-
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)