Click here to Skip to main content
15,901,122 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Could you help me with Rich Edit? Pin
David Crow20-Oct-05 4:21
David Crow20-Oct-05 4:21 
AnswerRe: Could you help me with Rich Edit? Pin
Reunion20-Oct-05 18:12
Reunion20-Oct-05 18:12 
QuestionRe: Could you help me with Rich Edit? Pin
David Crow21-Oct-05 3:15
David Crow21-Oct-05 3:15 
AnswerRe: Could you help me with Rich Edit? Pin
Reunion21-Oct-05 3:21
Reunion21-Oct-05 3:21 
GeneralRe: Could you help me with Rich Edit? Pin
David Crow21-Oct-05 4:27
David Crow21-Oct-05 4:27 
GeneralRe: Could you help me with Rich Edit? Pin
Reunion21-Oct-05 18:08
Reunion21-Oct-05 18:08 
GeneralRe: Could you help me with Rich Edit? Pin
David Crow24-Oct-05 3:11
David Crow24-Oct-05 3:11 
GeneralRe: Could you help me with Rich Edit? Pin
Reunion25-Oct-05 18:27
Reunion25-Oct-05 18:27 
One more and final: in your case the new text replaces the whole text in the control. So it's better to use ReplaceSel function instead of SetWindowText. Now everything is correct. Here is the final code:

<br />
void CRichEditCtrlEx::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)<br />
{<br />
    bool bPasted = false;<br />
    if((toupper(nChar) == 'V' && GetAsyncKeyState(VK_CONTROL)) || (nChar == VK_INSERT && GetAsyncKeyState(VK_SHIFT)))<br />
        if(IsClipboardFormatAvailable(CF_TEXT))<br />
            if(OpenClipboard() != FALSE){<br />
                HANDLE h = GetClipboardData(CF_TEXT);<br />
                if(h != NULL){<br />
                    LPTSTR lptstr = (LPTSTR)GlobalLock(h);<br />
                    if(lptstr != NULL){<br />
                        ReplaceSel(lptstr);<br />
                        GlobalUnlock(lptstr);<br />
                        bPasted = true;<br />
                    }<br />
                }<br />
                CloseClipboard();<br />
            }<br />
    if(!bPasted)<br />
        CRichEditCtrl::OnKeyDown(nChar, nRepCnt, nFlags);<br />
}<br />


Thank you once more!
QuestionForm view timer problem. Pin
ledallam17-Oct-05 18:43
ledallam17-Oct-05 18:43 
AnswerRe: Form view timer problem. Pin
kakan17-Oct-05 19:00
professionalkakan17-Oct-05 19:00 
GeneralRe: Form view timer problem. Pin
ledallam17-Oct-05 20:53
ledallam17-Oct-05 20:53 
Questionhow to create a setup file for a MFC project Pin
vikas amin17-Oct-05 18:11
vikas amin17-Oct-05 18:11 
AnswerRe: how to create a setup file for a MFC project Pin
Christian Graus17-Oct-05 18:16
protectorChristian Graus17-Oct-05 18:16 
GeneralRe: how to create a setup file for a MFC project Pin
Eytukan17-Oct-05 23:37
Eytukan17-Oct-05 23:37 
GeneralRe: how to create a setup file for a MFC project Pin
Christian Graus18-Oct-05 11:51
protectorChristian Graus18-Oct-05 11:51 
AnswerRe: how to create a setup file for a MFC project Pin
Ravi Bhavnani17-Oct-05 18:17
professionalRavi Bhavnani17-Oct-05 18:17 
AnswerRe: how to create a setup file for a MFC project Pin
yuduntang17-Oct-05 20:50
yuduntang17-Oct-05 20:50 
GeneralRe: how to create a setup file for a MFC project Pin
vikas amin19-Oct-05 2:29
vikas amin19-Oct-05 2:29 
QuestionAdd dialog to Cview Pin
LiYS17-Oct-05 16:32
LiYS17-Oct-05 16:32 
AnswerRe: Add dialog to Cview Pin
Christian Graus17-Oct-05 16:54
protectorChristian Graus17-Oct-05 16:54 
GeneralRe: Add dialog to Cview Pin
LiYS17-Oct-05 16:58
LiYS17-Oct-05 16:58 
GeneralRe: Add dialog to Cview Pin
Christian Graus17-Oct-05 17:06
protectorChristian Graus17-Oct-05 17:06 
GeneralRe: Add dialog to Cview Pin
LiYS17-Oct-05 17:18
LiYS17-Oct-05 17:18 
GeneralRe: Add dialog to Cview Pin
PJ Arends17-Oct-05 17:09
professionalPJ Arends17-Oct-05 17:09 
GeneralRe: Add dialog to Cview Pin
LiYS17-Oct-05 17:12
LiYS17-Oct-05 17:12 

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.