<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : (RESOLVED) Copy to clipboard</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Chart Control : (RESOLVED) Copy to clipboard]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 21 May 2026 04:33:51 +0000</pubDate>
  <lastBuildDate>Mon, 13 Jun 2011 01:48:25 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=18181</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard :   It seems CClientDC is the...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=64874&amp;title=resolved-copy-to-clipboard#64874</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2198">znakeeye</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 13 June 2011 at 1:48am<br /><br />It seems CClientDC is the key. This does not work:<div>&nbsp;</div><div>hdc = ::GetDC(m_hWnd); // Tried NULL too...</div><div>// Create compatible dc</div><div>&nbsp;</div><div>What's the difference between GetDC and CClientDC?</div>]]>
   </description>
   <pubDate>Mon, 13 Jun 2011 01:48:25 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=64874&amp;title=resolved-copy-to-clipboard#64874</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard : &amp;gt; The information on the Clipboard...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=64544&amp;title=resolved-copy-to-clipboard#64544</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=669">markr</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 23 May 2011 at 3:50pm<br /><br />&gt; The information on the Clipboard can't be inserted into Paint<br><br>You're using the code I shared with you?<br><br>Not sure what's going on there. I'm using that exact code in a production release without any problems.<br>]]>
   </description>
   <pubDate>Mon, 23 May 2011 15:50:46 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=64544&amp;title=resolved-copy-to-clipboard#64544</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard :   When pasting the image into...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=64526&amp;title=resolved-copy-to-clipboard#64526</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2198">znakeeye</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 22 May 2011 at 4:28pm<br /><br />When pasting the image into Paint, it tells me:<div>&nbsp;</div><div>---------------------------<br>Paint<br>---------------------------<br>The information on the Clipboard can't be inserted into Paint.<br>---------------------------<br>OK&nbsp;&nbsp; <br>---------------------------<br></div><div>&nbsp;</div><div>What?!</div>]]>
   </description>
   <pubDate>Sun, 22 May 2011 16:28:46 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=64526&amp;title=resolved-copy-to-clipboard#64526</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard :   Thanks! ]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63991&amp;title=resolved-copy-to-clipboard#63991</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2198">znakeeye</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 20 April 2011 at 1:53am<br /><br />Thanks!]]>
   </description>
   <pubDate>Wed, 20 Apr 2011 01:53:14 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63991&amp;title=resolved-copy-to-clipboard#63991</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard : Hi,Here&amp;#039;s the code I&amp;#039;m...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63951&amp;title=resolved-copy-to-clipboard#63951</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=669">markr</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 18 April 2011 at 9:56am<br /><br />Hi,<br><br>Here's the code I'm currently using for this purpose.<br><br>void CDFDChartControl::CopyToClipboard()<br>{<br>&nbsp;&nbsp;&nbsp; BITMAP bmpInfo;<br>&nbsp;&nbsp; &nbsp;m_bmpCache.GetBitmap(&amp;bmpInfo);<br><br>&nbsp;&nbsp; &nbsp;CBitmap bitmap;<br>&nbsp;&nbsp; &nbsp;CClientDC dcClient(AfxGetMainWnd());<br><br>&nbsp;&nbsp; &nbsp;CDC dcDest;<br>&nbsp;&nbsp; &nbsp;dcDest.CreateCompatibleDC(&amp;dcClient);<br><br>&nbsp;&nbsp; &nbsp;CDC dcSource;<br>&nbsp;&nbsp; &nbsp;dcSource.CreateCompatibleDC(&amp;dcClient);<br><br>&nbsp;&nbsp;&nbsp; HBITMAP oldhBitmap = (HBITMAP)dcSource.SelectObject((HBITMAP)m_bmpCache);<br><br>&nbsp;&nbsp;&nbsp; bitmap.CreateCompatibleBitmap(&amp;dcClient, bmpInfo.bmWidth, bmpInfo.bmHeight);<br><br>&nbsp;&nbsp;&nbsp; CBitmap* pOldBitmap = dcDest.SelectObject(&amp;bitmap);<br><br>&nbsp;&nbsp;&nbsp; ::BitBlt(dcDest, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, dcSource, 0, 0, SRCCOPY);<br><br>&nbsp;&nbsp;&nbsp; dcSource.SelectObject(oldhBitmap);<br>&nbsp;&nbsp; &nbsp;dcDest.SelectObject(pOldBitmap);<br><br>&nbsp;&nbsp;&nbsp; VERIFY(::OpenClipboard(AfxGetMainWnd()-&gt;m_hWnd));<br>&nbsp;&nbsp;&nbsp; VERIFY(::EmptyClipboard());<br>&nbsp;&nbsp;&nbsp; VERIFY(::SetClipboardData(CF_BITMAP, bitmap.Detach()));<br>&nbsp;&nbsp;&nbsp; ::CloseClipboard();<br>}]]>
   </description>
   <pubDate>Mon, 18 Apr 2011 09:56:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63951&amp;title=resolved-copy-to-clipboard#63951</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard :   I keep getting a black image....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63929&amp;title=resolved-copy-to-clipboard#63929</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2198">znakeeye</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 17 April 2011 at 4:27pm<br /><br />I keep getting a black image. What am I doing wrong?<div>&nbsp;</div><div>This is my copy-function:</div><div><font color="#010001" size="2" face="C&#111;nsolas"><font color="#010001" size="2" face="C&#111;nsolas"><font color="#010001" size="2" face="C&#111;nsolas"></font></font></font>&nbsp;</div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">BOOL CopyBitmap(CBitmap &amp;bmpDest, CBitmap &amp;bmpSource)<br>{<br>&nbsp;&nbsp;&nbsp; bmpDest.DeleteObject();</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; BITMAP bm;<br>&nbsp;&nbsp;&nbsp; bmpSource.GetBitmap(&amp;bm);</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; CDC sourceDC;<br>&nbsp;&nbsp;&nbsp; sourceDC.CreateCompatibleDC(NULL);</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; bmpDest.CreateCompatibleBitmap(&amp;sourceDC, bm.bmWidth, bm.bmHeight);</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; CDC destDC;<br>&nbsp;&nbsp;&nbsp; destDC.CreateCompatibleDC(NULL);</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; CBitmap *pOldSourceBitmap = sourceDC.SelectObject(&amp;bmpSource);<br>&nbsp;&nbsp;&nbsp; CBitmap *pOldDestBitmap = destDC.SelectObject(&amp;bmpDest);</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; destDC.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &amp;sourceDC, 0, 0, SRCCOPY);</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; sourceDC.SelectObject(pOldSourceBitmap);<br>&nbsp;&nbsp;&nbsp; destDC.SelectObject(pOldDestBitmap);</font></font></div><div><font size="2" face="C&#111;nsolas"><font size="2" face="C&#111;nsolas">&nbsp;&nbsp;&nbsp; return (bmpDest.m_hObject != NULL);<br>}</font></font></div><div><font size="2" face="C&#111;nsolas"></font>&nbsp;</div>]]>
   </description>
   <pubDate>Sun, 17 Apr 2011 16:27:10 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63929&amp;title=resolved-copy-to-clipboard#63929</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard : Thanks for the tip, Oleg. Working...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63776&amp;title=resolved-copy-to-clipboard#63776</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=669">markr</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 07 April 2011 at 1:36pm<br /><br />Thanks for the tip, Oleg. Working fine now.&nbsp; :-)]]>
   </description>
   <pubDate>Thu, 07 Apr 2011 13:36:33 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63776&amp;title=resolved-copy-to-clipboard#63776</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard : You better create copy of bitmap...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63772&amp;title=resolved-copy-to-clipboard#63772</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 07 April 2011 at 12:05pm<br /><br />You better create copy of bitmap because you should "detach" it to clipboard:<div><br></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">VERIFY(SetClipboardData(CF_BITMAP, bmpCopy.D<b>etach</b>()));</span></div>]]>
   </description>
   <pubDate>Thu, 07 Apr 2011 12:05:54 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63772&amp;title=resolved-copy-to-clipboard#63772</guid>
  </item> 
  <item>
   <title><![CDATA[(RESOLVED) Copy to clipboard :  Hello,I need to copy a chart...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63769&amp;title=resolved-copy-to-clipboard#63769</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=669">markr</a><br /><strong>Subject:</strong> 18181<br /><strong>Posted:</strong> 07 April 2011 at 11:15am<br /><br />Hello,<br><br>I need to copy a chart image (rendered via CXTPChartControl) to the Windows clipboard.<br><br>I tried deriving from CXTPChartControl and adding a method that copies the contents of the CBitmap cache object (m_bmpCache member) to the clipboard, but it does not work. Here's what I'm trying to do (stripped of error checking for brevity):<br><br>VERIFY(OpenClipboard());<br>VERIFY(EmptyClipboard());<br>VERIFY(SetClipboardData(CF_BITMAP, m_bmpCache.GetSafeHandle()));<br>CloseClipboard();<br><br>None of these function calls fail, but clipboard contents are not valid. Perhaps CBitmap cache object is not safe to use for this purpose?<br>]]>
   </description>
   <pubDate>Thu, 07 Apr 2011 11:15:00 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18181&amp;PID=63769&amp;title=resolved-copy-to-clipboard#63769</guid>
  </item> 
 </channel>
</rss>