Cutting From RichEdit

  • Thread starter news.tkdsoftware.com
  • Start date
N

news.tkdsoftware.com

When I create my richedit control, I specify the font to be a system fixed
font. When I cut from this control and paste it into an outlook message, I
would prefer the pasted content to always be plain text instead of weird
spaced lines and small font. How can I control this?

--
 
J

John Harrison

news.tkdsoftware.com said:
When I create my richedit control, I specify the font to be a system fixed
font. When I cut from this control and paste it into an outlook message,
I
would prefer the pasted content to always be plain text instead of weird
spaced lines and small font. How can I control this?

You've posted here often enough. You should know that it is the C++ language
that we discuss here not Windows programming. The best group for Windows
programming is I'm sure they can
answer your question.

john
 
N

news.tkdsoftware.com

I decided to intercept the message for VK_CONTROL+C and performed a manual
clipboard copy message of plain-text. Here's an excert from my code:

#define VK_C 67

BOOL COutputRichEditCtrl::preTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN) {
if(GetKeyState(VK_CONTROL) && pMsg->wParam == VK_C) {
PutSelInClipboard();
return TRUE;
}
}
return CRichEditCtrl::preTranslateMessage(pMsg);
}


void COutputRichEditCtrl::putSelInClipboard()
{
CString strText = GetSelText();
int nLen = strText.GetLength();
if(OpenClipboard()) {
EmptyClipboard();
HGLOBAL hText = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,nLen+4);
char *ptr = (char*)GlobalLock(hText);
strcpy(ptr, strText);
GlobalUnlock(hText);
::SetClipboardData(CF_TEXT,hText);
CloseClipboard();
GlobalFree(hText);
}
}

Hope this helps others and if there is a better way, feel free to post it.
Thanks,
Chris
 
W

White Wolf

news.tkdsoftware.com said:
I decided to intercept the message for VK_CONTROL+C and performed a
manual clipboard copy message of plain-text. Here's an excert from my
code:


Nobody cares here, this isn't a Windows newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top