Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add text to rich edit control

Status
Not open for further replies.

iranor

Programmer
Jun 17, 2004
174
0
0
CA
Ok, so I created an empty c++ project on visual studio. I created the main window, now I just added a Rich Edit control on it.

I don't know how to write text to it using code... I don't want to use an mfc app btw. I tried hTextZone->ReplaceSel("sometext"); and hTextZone->Lines->Add("text"); but I can't write text to my rich edit control.

Code:
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static HWND hTextZone;
    LoadLibrary("RICHED20.DLL");

switch (uMsg)
    {
		case WM_CREATE:
    hTextZone = CreateWindow("RichEdit20A", "", WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_NUMBER | WS_BORDER |  WS_VSCROLL | WS_TABSTOP, 5, 5, 580, 402, hwnd, NULL, hinst, NULL);
return 0;

Thanks in advance.
 
From the Platform SDK documentation:

ES_READONLY
Prevents the user from typing or editing text in the edit control.

Could this be the problem?

Good luck,

Greg Hansen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top