<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[problem beim drucken]]></title><description><![CDATA[<p>Hallo,</p>
<p>warum schmiert mir mein Programm an der Stelle</p>
<pre><code>pDC.Attach(dlgPrint.GetPrinterDC());
</code></pre>
<p>ab,<br />
wenn ich statt</p>
<pre><code>CPrintDialog dlgPrint(FALSE, PD_NOSELECTION, this);
</code></pre>
<pre><code>CPrintDialog dlgPrint(TRUE, PD_NOSELECTION, this);
</code></pre>
<p>schreibe?</p>
<pre><code>void CEnglsih_v2View::OnVokabelnButtonPrintToLearn()
{
	CPrintDialog dlgPrint(FALSE, PD_NOSELECTION, this);
	if (dlgPrint.DoModal()==IDOK)
	{
		CDC			pDC;
		CEnglsih_v2Doc *pDoc=GetDocument();
		DOCINFO		Print;
		int			pageWidth, pageHeight;
		CString		str;
		CSize		szTemp1;
		TEXTMETRIC	tm;
		CFont		font240Bold;

		pDC.Attach(dlgPrint.GetPrinterDC());
		Print.cbSize = sizeof(Print); 
		Print.lpszDocName = TEXT(&quot;Dateiliste&quot;); 
		Print.lpszOutput = NULL; 
		Print.lpszDatatype = NULL; 
		Print.fwType = NULL; 

		pageWidth =		pDC.GetDeviceCaps(HORZSIZE);
		pageHeight  =	pDC.GetDeviceCaps(VERTSIZE);

		//Schriftarten defienieren
		//BOOL CreateFont(	int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight,
		//					BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, 
		//					BYTE nOutPrecision, BYTE nClipPrecision, 
		//					BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename );
		font240Bold.CreateFont(100,0,0,0,700,
							FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
							CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS, &quot;Times New Roman&quot;);

		if(pDC.StartDoc(&amp;Print))
		{
			pDC.StartPage();

			// MapMode festlegen
			pDC.SetMapMode(MM_LOMETRIC);

			str=pDoc-&gt;myVokabelArray[m_intaktuellePositionInArray]-&gt;GetEnglish();
			szTemp1=pDC.GetTextExtent(str);
			pDC.TextOut(((pageWidth*10)/2)-(szTemp1.cx/2),-500,str);

			pDC.EndPage();

		}
		pDC.EndDoc();
		return;
	}

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/190239/problem-beim-drucken</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 16:54:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/190239.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 Aug 2007 05:27:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problem beim drucken on Tue, 21 Aug 2007 05:27:33 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>warum schmiert mir mein Programm an der Stelle</p>
<pre><code>pDC.Attach(dlgPrint.GetPrinterDC());
</code></pre>
<p>ab,<br />
wenn ich statt</p>
<pre><code>CPrintDialog dlgPrint(FALSE, PD_NOSELECTION, this);
</code></pre>
<pre><code>CPrintDialog dlgPrint(TRUE, PD_NOSELECTION, this);
</code></pre>
<p>schreibe?</p>
<pre><code>void CEnglsih_v2View::OnVokabelnButtonPrintToLearn()
{
	CPrintDialog dlgPrint(FALSE, PD_NOSELECTION, this);
	if (dlgPrint.DoModal()==IDOK)
	{
		CDC			pDC;
		CEnglsih_v2Doc *pDoc=GetDocument();
		DOCINFO		Print;
		int			pageWidth, pageHeight;
		CString		str;
		CSize		szTemp1;
		TEXTMETRIC	tm;
		CFont		font240Bold;

		pDC.Attach(dlgPrint.GetPrinterDC());
		Print.cbSize = sizeof(Print); 
		Print.lpszDocName = TEXT(&quot;Dateiliste&quot;); 
		Print.lpszOutput = NULL; 
		Print.lpszDatatype = NULL; 
		Print.fwType = NULL; 

		pageWidth =		pDC.GetDeviceCaps(HORZSIZE);
		pageHeight  =	pDC.GetDeviceCaps(VERTSIZE);

		//Schriftarten defienieren
		//BOOL CreateFont(	int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight,
		//					BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, 
		//					BYTE nOutPrecision, BYTE nClipPrecision, 
		//					BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename );
		font240Bold.CreateFont(100,0,0,0,700,
							FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
							CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS, &quot;Times New Roman&quot;);

		if(pDC.StartDoc(&amp;Print))
		{
			pDC.StartPage();

			// MapMode festlegen
			pDC.SetMapMode(MM_LOMETRIC);

			str=pDoc-&gt;myVokabelArray[m_intaktuellePositionInArray]-&gt;GetEnglish();
			szTemp1=pDC.GetTextExtent(str);
			pDC.TextOut(((pageWidth*10)/2)-(szTemp1.cx/2),-500,str);

			pDC.EndPage();

		}
		pDC.EndDoc();
		return;
	}

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1348622</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1348622</guid><dc:creator><![CDATA[ratmann]]></dc:creator><pubDate>Tue, 21 Aug 2007 05:27:33 GMT</pubDate></item><item><title><![CDATA[Reply to problem beim drucken on Tue, 21 Aug 2007 06:34:50 GMT]]></title><description><![CDATA[<p>Weil durch dieses Flag nur der Print Setup Dialog aufgerufen wird und kein DC erzeugt wird!</p>
<p>Es steht doch auch entsprechend in der Doku:<br />
<a href="http://msdn2.microsoft.com/en-us/library/32762a1z(VS.80).aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/32762a1z(VS.80).aspx</a></p>
<p>Note that when you call the constructor with bPrintSetupOnly set to FALSE, the PD_RETURNDC flag is automatically used. After calling DoModal, GetDefaults, or GetPrinterDC, a printer DC will be returned in m_pd.hDC. This DC must be freed with a call to DeleteDC by the caller of CPrintDialog.</p>
<p>In anderen Worten. Möchtest Du dennoch einen DC, dann setze auch das Flag PD_RETURNDC.</p>
<pre><code class="language-cpp">CPrintDialog dlgPrint(TRUE, PD_NOSELECTION|PD_RETURNDC, this);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1348643</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1348643</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 21 Aug 2007 06:34:50 GMT</pubDate></item></channel></rss>