views:

143

answers:

1

I'm trying to create a text editor in vc++, without using mfc's edit class. I've managed to capture the key pressed using WM_CHAR message, but now how can i add it into a string(or any character handling data type) so that i can display it in my client area using TextOut() or functons similar to it???

A: 

if it's a plain char array then you can use

your_str[strlen(your_str)] = ch;

where ch is the character.

Watch our for running out of space in your_str

Diaa Sami
sorry for asking an unclear question, once i get to know which key has been pressed(inside the WndProc, using WM_CHAR message and then using its wparam to know the key), what should i do to display it in my client area??.
@Arun I'm not GDI expert but I think after you add the char to your string you should invalidate your editor area, this will lead to you getting a WM_PAINT so you can repaint the string again.
Diaa Sami
yea, i understood. thanks for replying..