Click here to Skip to main content
15,902,786 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: std::string to float Pin
Rob Caldecott4-May-06 13:18
Rob Caldecott4-May-06 13:18 
GeneralRe: std::string to float Pin
Stephen Hewitt4-May-06 15:06
Stephen Hewitt4-May-06 15:06 
QuestionTray icon notifier when usb plugging Pin
asancho4-May-06 6:32
asancho4-May-06 6:32 
AnswerRe: Tray icon notifier when usb plugging Pin
toxcct4-May-06 6:44
toxcct4-May-06 6:44 
GeneralRe: Tray icon notifier when usb plugging Pin
asancho5-May-06 1:36
asancho5-May-06 1:36 
QuestionXML string to DataTable Pin
lsugirljte4-May-06 6:27
lsugirljte4-May-06 6:27 
GeneralRe: XML string to DataTable Pin
lsugirljte4-May-06 6:29
lsugirljte4-May-06 6:29 
QuestionAppending text to a richedit Pin
KellyR4-May-06 6:05
KellyR4-May-06 6:05 
Hi, so my problem is threefold, here it is:

I want to append text to a richedit.

Right now, I'm doing this:
chat_window_rich.SetSel(GetWindowTextLength(chat_window_rich), -1);
chat_window_rich.SetSelectionCharFormat(cf);
chat_window_rich.ReplaceSel(buff);

That would be fine except for two reasons.

1: The program is multithreaded, and sometimes messages will come in at almost exactly the same time, overwriting each other (like I presume the one sets based on windowtextlength, and then the ohter one sets based on the same length before the first one is appended, then the second just overwrites the first)

2: If someone is in the middle of dragging the cursor to select text, the incoming text will destroy all of the selected text and replace it (presumably the carat is reset from the cursor dragging, from the end of the text to something before it, i.e. whatever is being selected).

I tried locking shared memory right before I set and replace the selection to prevent the multithreaded message receiving problem, however this sometimes causes the program to freeze (infinite memory lock, even though the way I have it coded, it appears to me as if this is totally impossible, and I even have a wait timer on the lock to release the memory if it takes too long, but this doesn't always work for some reason).

So my question: Is there a way to append text to a richedit WITHOUT setting the carat with setsel? I really want to append the text without messing with whatever's being selected by the person's cursor.

If there isn't, does anyone else have suggestions? This sort of thing is obviously possible since it's done in AIM and other chat programs.

Thanks!

Kelly Ryan
AnswerRe: Appending text to a richedit Pin
Justin Tay4-May-06 12:17
Justin Tay4-May-06 12:17 
Questionmonitoring print dialog box Pin
Atron4-May-06 4:58
Atron4-May-06 4:58 
QuestionThank you Pin
Charles Reese4-May-06 4:51
Charles Reese4-May-06 4:51 
AnswerRe: Thank you Pin
toxcct4-May-06 5:22
toxcct4-May-06 5:22 
GeneralRe: Thank you Pin
Eytukan4-May-06 6:12
Eytukan4-May-06 6:12 
QuestionUrgent: Trapping documentcomplete event in IE browser Pin
rana744-May-06 4:19
rana744-May-06 4:19 
AnswerRe: Urgent: Trapping documentcomplete event in IE browser Pin
led mike4-May-06 7:52
led mike4-May-06 7:52 
AnswerRe: Urgent: Trapping documentcomplete event in IE browser Pin
Sheng Jiang 蒋晟4-May-06 15:10
Sheng Jiang 蒋晟4-May-06 15:10 
QuestionOle DB for OLAP Pin
Tarek Jabri4-May-06 4:13
Tarek Jabri4-May-06 4:13 
AnswerRe: Ole DB for OLAP Pin
Steve Echols4-May-06 20:03
Steve Echols4-May-06 20:03 
QuestionOle DB for OLAP Pin
Tarek Jabri4-May-06 4:11
Tarek Jabri4-May-06 4:11 
QuestionHow to keep image displayed in dialog box? Pin
houari_id4-May-06 3:55
houari_id4-May-06 3:55 
AnswerRe: How to keep image displayed in dialog box? Pin
Cedric Moonen4-May-06 4:13
Cedric Moonen4-May-06 4:13 
GeneralRe: How to keep image displayed in dialog box? Pin
houari_id5-May-06 8:22
houari_id5-May-06 8:22 
GeneralRe: How to keep image displayed in dialog box? Pin
Cedric Moonen5-May-06 21:53
Cedric Moonen5-May-06 21:53 
QuestionCheckbox with BITMAP Pin
Raja Bose C Leo4-May-06 3:30
Raja Bose C Leo4-May-06 3:30 
AnswerRe: Checkbox with BITMAP Pin
toxcct4-May-06 3:44
toxcct4-May-06 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.