Click here to Skip to main content
16,012,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: volume control Pin
Prem Kumar1-Apr-02 16:56
Prem Kumar1-Apr-02 16:56 
GeneralCHtmlView Question Pin
1-Apr-02 15:53
suss1-Apr-02 15:53 
GeneralRe: CHtmlView Question Pin
Paul M Watt1-Apr-02 16:55
mentorPaul M Watt1-Apr-02 16:55 
GeneralRe: CHtmlView Question Pin
1-Apr-02 17:57
suss1-Apr-02 17:57 
Generalblinking cursor position Pin
bracoute1-Apr-02 13:19
bracoute1-Apr-02 13:19 
GeneralRe: blinking cursor position Pin
Prem Kumar1-Apr-02 16:55
Prem Kumar1-Apr-02 16:55 
GeneralRe: blinking cursor position Pin
bracoute1-Apr-02 19:14
bracoute1-Apr-02 19:14 
GeneralClipboard Copy - multiple formats Pin
Aaron Schaefer1-Apr-02 13:02
Aaron Schaefer1-Apr-02 13:02 
Hi All,

I've got an app that eeds to copy some data to the clipboard. I wrote some code to do this based on a couple of articles I found here, and implemented a copy to clipoboard functionlaity for plain text. So far, so good. But, no I need to copy the same data out as RTF also. Anybody know a simple way I can copy data to the clipboard in multiple formats? Here's sopme code that's not quite working, I am getting a debug assertion the second time through the loop, for the second clipboard format (RTF(:

void CClipboardItem::CopyToClipboard(HWND& hWndNewOwner)
{

// Open the clipboard
OpenClipboard(hWndNewOwner);
EmptyClipboard();

// For every format in the set of supported formats, render data
FormatIterator it;
UINT uFormat;
for(it = m_setFormats.begin(); it != m_setFormats.end(); it++)
{
// Create a shared memory file
CSharedFile sf(GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT);

// Render the clipboard data to te shared memory file for the given format
uFormat = *it;
RenderClipboardData(sf, uFormat);

SetClipboardData(uFormat, sf.Detach()); // OOPS! This asserts the second time

}

// All done, let go of the clipboard
CloseClipboard();

}

Any idea why this doesn't work?
GeneralMessage Reflection Pin
1-Apr-02 13:01
suss1-Apr-02 13:01 
GeneralMessage Relfection Pin
1-Apr-02 13:01
suss1-Apr-02 13:01 
GeneralRe: Message Relfection Pin
Shog91-Apr-02 13:08
sitebuilderShog91-Apr-02 13:08 
GeneralRe: Message Relfection Pin
1-Apr-02 13:11
suss1-Apr-02 13:11 
GeneralRe: Message Relfection Pin
Shog91-Apr-02 13:25
sitebuilderShog91-Apr-02 13:25 
GeneralRe: Message Relfection Pin
1-Apr-02 13:30
suss1-Apr-02 13:30 
GeneralRe: Message Relfection Pin
1-Apr-02 13:51
suss1-Apr-02 13:51 
GeneralRe: Message Relfection Pin
Shog91-Apr-02 17:57
sitebuilderShog91-Apr-02 17:57 
Generalpassword protect folder Pin
Steven Richardson1-Apr-02 11:03
Steven Richardson1-Apr-02 11:03 
GeneralRe: password protect folder Pin
dazinith1-Apr-02 11:23
dazinith1-Apr-02 11:23 
GeneralRe: password protect folder Pin
Steven Richardson1-Apr-02 11:27
Steven Richardson1-Apr-02 11:27 
GeneralRe: password protect folder Pin
dazinith1-Apr-02 11:33
dazinith1-Apr-02 11:33 
GeneralRe: password protect folder Pin
alex.barylski1-Apr-02 15:52
alex.barylski1-Apr-02 15:52 
GeneralRe: password protect folder Pin
Mukkie2-Apr-02 5:54
Mukkie2-Apr-02 5:54 
GeneralMultithreading Pin
RK_20001-Apr-02 10:10
RK_20001-Apr-02 10:10 
GeneralRe: Multithreading Pin
Tim Smith1-Apr-02 10:20
Tim Smith1-Apr-02 10:20 
GeneralRe: Multithreading Pin
Paul M Watt1-Apr-02 10:33
mentorPaul M Watt1-Apr-02 10:33 

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.