<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual C++ Tips &#187; CFrameWnd</title>
	<atom:link href="http://weseetips.com/tag/cframewnd/feed/" rel="self" type="application/rss+xml" />
	<link>http://weseetips.com</link>
	<description>Gold mine of Visual C++ tricks!</description>
	<lastBuildDate>Thu, 11 Mar 2010 09:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>How to Print the CView directly to Printer?</title>
		<link>http://weseetips.com/2009/01/06/how-to-print-the-cview-directly-to-printer/</link>
		<comments>http://weseetips.com/2009/01/06/how-to-print-the-cview-directly-to-printer/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 22:15:40 +0000</pubDate>
		<dc:creator>Jijo Raj</dc:creator>
				<category><![CDATA[Codeproject]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[CFrameWnd]]></category>
		<category><![CDATA[CView::OnCmdMsg()]]></category>
		<category><![CDATA[document/view print]]></category>
		<category><![CDATA[GetActiveView()]]></category>
		<category><![CDATA[ID_FILE_PRINT]]></category>
		<category><![CDATA[ID_FILE_PRINT_DIRECT]]></category>
		<category><![CDATA[mdi print]]></category>
		<category><![CDATA[print CView]]></category>
		<category><![CDATA[print document]]></category>
		<category><![CDATA[print view]]></category>
		<category><![CDATA[sdi print]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=836</guid>
		<description><![CDATA[MFC&#8217;s Document/View framework have built-in printing support for applications. If you create one SDI or MDI application, you can take the print by using the File-&#62;Print menu. But the menu handling and print functionality is buried deep inside mfc framework. Well, how to take the print of current view by your own? Picture Courtesy &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" alt="" width="166" height="32" /><br />
<span style="color:#0000ff;"> MFC&#8217;s Document/View framework have built-in printing support for applications.</span> If you create one SDI or MDI application, you can take the print by using the File-&gt;Print menu. But the menu handling and print functionality is buried deep inside mfc framework. <span style="color:#0000ff;">Well, how to take the print of current view by your own?</span></p>
<p><img class="alignnone size-full wp-image-841" title="printview" src="http://siteground205.com/~weseetip/wp-content/uploads/2009/01/printview.jpg" alt="printview" width="510" height="367" /><br />
Picture Courtesy &#8211; <a href="http://www.daycad.com/">DayCad</a>.</p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" alt="" width="220" height="32" /><br />
You have to call <span style="color:#0000ff;">CView::OnCmdMsg()</span> by passing <span style="color:#0000ff;">ID_FILE_PRINT</span> or <span style="color:#0000ff;">ID_FILE_PRINT_DIRECT</span>. If ID_FILE_PRINT is passed, the printer dialog will be shown and for ID_FILE_PRINT_DIRECT, the print will be taken directly with default printer parameters. Have a look at the code snippet.</p>
<pre>// Get the active view.
CFrameWnd* pFrameWnd = (CFrameWnd*)AfxGetApp()-&gt;GetMainWnd();
CView* pView = pFrameWnd-&gt;GetActiveView();

if( pView != NULL )
{
    // Send Print message.
    // If you want to print directly, then change ID_FILE_PRINT
    // to ID_FILE_PRINT_DIRECT.
    pView-&gt;OnCmdMsg( ID_FILE_PRINT, 0, 0, 0 );
}</pre>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" alt="" width="94" height="32" /><br />
Its interesting to know MFC internals. isn&#8217;t it?</p>
<p><img class="alignnone size-medium wp-image-53" title="intermediateseries" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" alt="" width="248" height="32" /><br />
Targeted Audience &#8211; Intermediate.</p>
]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2009/01/06/how-to-print-the-cview-directly-to-printer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

