Board index » cppbuilder » Copy RTF Clipboard

Copy RTF Clipboard


2004-06-04 04:44:41 PM
cppbuilder26
I am interesting for getting RTF data stored in the Clipboard. So I am
looking for the capability for getting RTF text from the Clipboard, but the
method Clipboard()->GetTextBuf retrieves only ascii text not RTF ?
Why ?
Sam
 
 

Re:Copy RTF Clipboard

Sam wrote:
Quote
I am interesting for getting RTF data stored in the Clipboard. So I am
looking for the capability for getting RTF text from the Clipboard, but the
method Clipboard()->GetTextBuf retrieves only ascii text not RTF ?
Why ?
Because you ased for text so you will get text. The help for
Clipboard()->GetTextBuf() clearly states that it retrieves text.
If you take a TRichEdit it will grab the rtf data from the clipboard:
RichEdit1->PasteFromClipBoard();
Hans,
 

Re:Copy RTF Clipboard

"Sam" < XXXX@XXXXX.COM >wrote in message
Quote
the method Clipboard()->GetTextBuf retrieves
only ascii text not RTF ?
That is because you are not asking the clipboard for RTF to begin with. You
are asking it for plain text. The two are not stored the same way. The
clipboard can hold many different types of data, not just text data.
Gambit
 

{smallsort}

Re:Copy RTF Clipboard

"Sam" < XXXX@XXXXX.COM >wrote:
Quote
[...] but the method Clipboard()->GetTextBuf retrieves only
ascii text not RTF ? Why ?
Because that's what it's suposed to do, give you the text.
The easiest way to get the formatting is to paste into a
TRichEdit and it will work if the control is Visible or not.
The only other way is to access the ClipBoard directly. Can
you read delphi?
216.101.185.148/scripts/isapi.dll/article
You might also benifit from looking at all of the files in the
..\Examples\Apps\RichEdit folder
~ JD
 

Re:Copy RTF Clipboard

Thanks for all, I will use a RichEdit.
Sam
"JD" < XXXX@XXXXX.COM >a écrit dans le message de
Quote

"Sam" < XXXX@XXXXX.COM >wrote:
>[...] but the method Clipboard()->GetTextBuf retrieves only
>ascii text not RTF ? Why ?

Because that's what it's suposed to do, give you the text.
The easiest way to get the formatting is to paste into a
TRichEdit and it will work if the control is Visible or not.

The only other way is to access the ClipBoard directly. Can
you read delphi?


216.101.185.148/scripts/isapi.dll/article

You might also benifit from looking at all of the files in the
..\Examples\Apps\RichEdit folder

~ JD

 

Re:Copy RTF Clipboard

"JD" < XXXX@XXXXX.COM >wrote in message
Quote
The only other way is to access the ClipBoard directly.
That is what you should do. For example:
#include <richedit.h>
#include <ClipBrd.hpp>
Word wFormatRTF = RegisterClipboardFormat(CF_RTF);
//...
AnsiString __fastcall GetRTFFromClipboard()
{
AnsiString Result;
Clipboard()->Open();
try
{
if( Clipboard()->HasFormat(wFormatRTF) )
{
HANDLE hData = (HANDLE)
Clipboard()->GetAsHandle(wFormatRTF);
char *pData = (char*) GlobalLock(hData);
try {
Result = pData;
}
__finally {
GlobalUnlock(hData);
}
}
}
__finally {
Clipboard()->Close();
}
return Result;
}
You might want to double-check your URL. It doesn't work.
Gambit
 

Re:Copy RTF Clipboard

"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

"JD" < XXXX@XXXXX.COM >wrote in message
news:40c0456a$ XXXX@XXXXX.COM ...

>The only other way is to access the ClipBoard directly.

That is what you should do. For example:
Cut-n-pasted to my knowledge base thank you.
Quote
You might want to double-check your URL. It doesn't work.
Geez. How did that happen?
~ JD