|
TClipboard class의 메소드 중에서 GetAsHandle, SetAsHandle을 이용하면 RTF나 그림들을 처리할 수 있을 것 같습니다. 제가 구체적으로 처리해 본 것이 아니어서, 확실한 답은 드리기가 그렇네요. C Builder의 도움말을 참조하시면 될 것 같습니다. 예제도 함께 있으니....
만약에 해결이 않되면 리플을 달아 주세요. 제가 구체적으로 해 볼께요.
참고로 standard clipboard의 type을 기술해 놓습니다.
Standard Clipboard Formats
The clipboard formats defined by the system are called standard clipboard formats. These clipboard formats are described in the following table.
Value Meaning
CF_BITMAP
A handle to a bitmap (HBITMAP).
CF_DIB
A memory object containing aBITMAPINFO structure followed by the bitmap bits.
CF_DIBV5
Windows NT 5.0: A memory object containing aBITMAPV5HEADER structure followed by the bitmap color space information and the bitmap bits.
CF_DIF
Software Arts' Data Interchange Format.
CF_DSPBITMAP
Bitmap display format associated with a private format. The hMem parameter must be a handle of data that can be displayed in bitmap format in lieu of the privately formatted data.
CF_DSPENHMETAFILE
Enhanced metafile display format associated with a private format. The hMem parameter must be a handle of data that can be displayed in enhanced metafile format in lieu of the privately formatted data.
CF_DSPMETAFILEPICT
Metafile-picture display format associated with a private format. The hMem parameter must be a handle of data that can be displayed in metafile-picture format in lieu of the privately formatted data.
CF_DSPTEXT
Text display format associated with a private format. The hMem parameter must be a handle of data that can be displayed in text format in lieu of the privately formatted data.
CF_ENHMETAFILE
A handle of an enhanced metafile (HENHMETAFILE).
CF_GDIOBJFIRST
through CF_GDIOBJLAST Range of integer values for application-defined GDI object clipboard formats. Handles associated with clipboard formats in this range are not automatically deleted using the GlobalFree function when the clipboard is emptied. Also, when using values in this range, the hMem parameter is not a handle to a GDI object, but is a handle allocated by the GlobalAlloc function with the GMEM_DDESHARE and GMEM_MOVEABLE flags.
CF_HDROP
A handle of type HDROP that identifies a list of files. An application can retrieve information about the files by passing the handle to the DragQueryFile functions.
CF_LOCALE
The data is a handle to the locale identifier associated with text in the clipboard. When you close the clipboard, if it contains CF_TEXT data but no CF_LOCALE data, the system automatically sets the CF_LOCALE format to the current input locale. You can use the
CF_LOCALE
format to associate a different locale with the clipboard text.
An application that pastes text from the clipboard can retrieve this format to determine which character set was used to generate the text.
Note that the clipboard does not support plain text in multiple character sets. To achieve this, use a fomatted text data type such as RTF instead.
Windows NT: The system uses the code page associated with CF_LOCALE to implicitly convert from CF_TEXT to CF_UNICODETEXT. Therefore, the correct code page table is used for the conversion.
CF_METAFILEPICT
Handle of a metafile picture format as defined by the METAFILEPICT structure. When passing a
CF_METAFILEPICT
handle by means of dynamic data exchange (DDE), the application responsible for deleting hMem should also free the metafile referred to by the CF_METAFILEPICT handle.
CF_OEMTEXT
Text format containing characters in the OEM character set. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data.
CF_OWNERDISPLAY
Owner-display format. The clipboard owner must display and update the clipboard viewer window, and receive the WM_ASKCBFORMATNAME, WM_HSCROLLCLIPBOARD, WM_PAINTCLIPBOARD, WM_SIZECLIPBOARD, and WM_VSCROLLCLIPBOARD messages. The hMem parameter must be NULL.
CF_PALETTE
Handle of a color palette. Whenever an application places data in the clipboard that depends on or assumes a color palette, it should place the palette on the clipboard as well.
If the clipboard contains data in the CF_PALETTE (logical color palette) format, the application should use theSelectPalette andRealizePalette functions to realize (compare) any other data in the clipboard against that logical palette.
When displaying clipboard data, the clipboard always uses as its current palette any object on the clipboard that is in the CF_PALETTE format.
CF_PENDATA
Data for the pen extensions to the Microsoft® Windows® for Pen Computing.
CF_PRIVATEFIRST
through CF_PRIVATELAST Range of integer values for private clipboard formats. Handles associated with private clipboard formats are not freed automatically; the clipboard owner must free such handles, typically in response to the WM_DESTROYCLIPBOARD message.
CF_RIFF
Represents audio data more complex than can be represented in a CF_WAVE standard wave format.
CF_SYLK
Microsoft Symbolic Link (SYLK) format.
CF_TEXT
Text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data. Use this format for ANSI text.
CF_WAVE
Represents audio data in one of the standard wave formats, such as 11 kHz or 22 kHz pulse code modulation (PCM).
CF_TIFF
Tagged-image file format.
CF_UNICODETEXT
Windows NT: Unicode text format. Each line ends with a carriage return/linefeed (CR-LF) combination. A null character signals the end of the data.
Jun 님이 쓰신 글 :
: 안녕하세요...
:
: 클립보드의 내용을 백업해 놓고 새로운 내용을 저장 한 후에 그 내용을 사용한 후 다시 클립보드의 내용을 이전의 내용으로 돌려놓으려고 합니다.
:
: Clipboard의 GetTextBuf,SetTextBuf를 통해서 일부 간단하게 구현을 했는데요..
:
: 텍스트를 copy시에 이전의 형식을 잃어버리더라구요..(폰트, 색깔, 들여쓰기 등등...)
:
: 또 이전의 내용이 bitmap이나 metafile이었을 경우에는 복원 자체가 불가능 하구요...
:
: 이전의 내용을 완벽하게 복원하여 다시 클립보드를 채워줄 방법이 있을까요....
:
: 답변 부탁드립니다...
:
: 아래에는 지금의 구현소스를 올려놓았습니다.(후킹을 통하여 이루어지는 루틴입니다.)
:
: TClipboard *cb2 = new TClipboard();
:
: cb2->GetTextBuf(backupbuf, sizeof(backupbuf)); //이전의 텍스트 내용 추출..char형.
:
: SendMessage(targetWnd, WM_COPY, 0x00000000, 0x00000000); //클립보드에 focus창의 셀렉트된 내용 카피...
:
: cb2->GetTextBuf(buf, sizeof(buf)); //새로운 내용 추출. char형.
:
: if(strcmp(buf,backupbuf) && (Clipboard()->HasFormat(CF_TEXT)))
: Edit1->Text = buf; //edit창에 카피 된 텍스트 뿌려줌.
:
: cb2->SetTextBuf(backupbuf); //이전의 텍스트를 클립보드에 저장.
: delete cb2;
:
|