Caret not positioned in Richedit
-
Greetings... I am using the following code to paste data in the Rich Edit control in my application. HGLOBAL hglb; LPTSTR lptstr; if (!OpenClipboard(this->uHWND)) return; hglb = GetClipboardData(CF_TEXT); if (hglb != NULL) { lptstr = (char*)GlobalLock(hglb); if (lptstr != NULL) { SendMessage ( this->uHWND, EM_REPLACESEL, TRUE, (LPARAM)lptstr ); GlobalUnlock(hglb); } } CloseClipboard(); return; } Now the problem is that sometimes the caret of the edit box is not positioned where it should be ? After pasting the caret moves to 2-3 characters before the end, but when I start typing or do any editing then work is done from the end as expected. So why the caret is not being viewed at the proper place when I paste the data ? Any help will be appreciated. Thanks. Ritesh